-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accessibility: Dismiss BlockMover tooltips on escape key press. #15578
Closed
nicolad
wants to merge
22
commits into
WordPress:master
from
nicolad:accessibility/improve-tooltips-behavior
Closed
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
ae832dc
Accessibility: dismiss BlockMover tooltips on escape key press.
nicolad dc86b93
Accessibility: Make tooltips dismissable onMouseDown.
nicolad 9a61a03
Merge branch 'master' into accessibility/improve-tooltips-behavior
nicolad 861351c
Merge branch 'master' into accessibility/improve-tooltips-behavior
nicolad ceae20d
Merge branch 'master' into accessibility/improve-tooltips-behavior
nicolad 62b163d
Merge branch 'master' into accessibility/improve-tooltips-behavior
nicolad 60bbc6c
Imported KeyboardShortcuts into Tooltip.
nicolad 8ae4d23
Fixed KeyboardShortcuts import and wrapped children with this.
nicolad 4379cf3
Updated the import and wrapped popover content.
nicolad 919831f
Wrapped correct elements.
nicolad f0962b3
test-unit:update summary --- 7 snapshots updated from 2 test suites.
nicolad 9741f77
unit-tests temp fix
nicolad ee9b1a5
Conflicts fixed.
nicolad 0331775
Merge branch 'master' of github.com:WordPress/gutenberg into accessib…
nicolad 67cfdf7
Merge branch 'master' of github.com:WordPress/gutenberg into accessib…
nicolad b23a066
Removed KeyboardShortcuts and checked escape key press.
nicolad 2dfaf5b
Updated snapshots.
nicolad 10e7a32
Merge branch 'master' into accessibility/improve-tooltips-behavior
nicolad a6f7be2
Moved destructuring back.
nicolad 22ef4e2
Merge branch 'master' of github.com:WordPress/gutenberg into accessib…
nicolad 68dd831
Removed obsolete onMouseEnter and onMouseLeave handlers.
nicolad 87321bd
Conflicts fixed.
nicolad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ import { | |
cloneElement, | ||
concatChildren, | ||
} from '@wordpress/element'; | ||
import { ESCAPE } from '@wordpress/keycodes'; | ||
|
||
/** | ||
* Internal dependencies | ||
|
@@ -89,6 +90,11 @@ class Tooltip extends Component { | |
return; | ||
} | ||
|
||
// If pressed key is escape, no further actions are needed. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit confused by this. What actions have been taken at this point in the event handler when pressing Escape? |
||
if ( event.keyCode === ESCAPE ) { | ||
return; | ||
} | ||
|
||
// A focus event will occur as a result of a mouse click, but it | ||
// should be disambiguated between interacting with the button and | ||
// using an explicit focus shift as a cue to display the tooltip. | ||
|
@@ -157,10 +163,11 @@ class Tooltip extends Component { | |
return cloneElement( child, { | ||
onMouseEnter: this.createToggleIsOver( 'onMouseEnter', true ), | ||
onMouseLeave: this.createToggleIsOver( 'onMouseLeave' ), | ||
onMouseDown: this.createSetIsMouseDown( true ), | ||
onClick: this.createToggleIsOver( 'onClick' ), | ||
onKeyDown: this.createToggleIsOver( 'onKeyDown' ), | ||
onFocus: this.createToggleIsOver( 'onFocus' ), | ||
onBlur: this.createToggleIsOver( 'onBlur' ), | ||
onMouseDown: this.createSetIsMouseDown( true ), | ||
children: concatChildren( | ||
child.props.children, | ||
isOver && ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Readability improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting that this will probably conflict with changes currently proposed in #19193 . Regardless if it's an improvement, I might suggest to remove it here, since it's not entirely relevant (or close in proximity) to the intended changes.