Skip to content
This repository has been archived by the owner on Mar 4, 2020. It is now read-only.

fix(MenuItem): click triggering logic on Space and Enter key press #1175

Merged
merged 3 commits into from
Apr 5, 2019

Conversation

kuzhelov
Copy link
Contributor

@kuzhelov kuzhelov commented Apr 5, 2019

Fixes #1155 .

This PR introduces fix for accessibility logic that is aimed to trigger click event handler on Space and Enter key events.

The problem was that click was triggered unconditionally while, to match browser's behavior, it should be triggered only in case if event is not default-prevented by e.preventDefault().

@codecov
Copy link

codecov bot commented Apr 5, 2019

Codecov Report

Merging #1175 into master will not change coverage.
The diff coverage is 0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1175   +/-   ##
=======================================
  Coverage   82.38%   82.38%           
=======================================
  Files         733      733           
  Lines        8720     8720           
  Branches     1230     1231    +1     
=======================================
  Hits         7184     7184           
  Misses       1521     1521           
  Partials       15       15
Impacted Files Coverage Δ
packages/react/src/components/Menu/MenuItem.tsx 59.48% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f3ed2d1...8e2d0f0. Read the comment docs.

@kuzhelov kuzhelov added 🚧 WIP and removed 🚧 WIP labels Apr 5, 2019
@@ -285,7 +285,7 @@ class MenuItem extends AutoControlledComponent<ReactProps<MenuItemProps>, MenuIt
}

protected actionHandlers: AccessibilityActionHandlers = {
performClick: event => this.handleClick(event),
performClick: event => !event.defaultPrevented && this.handleClick(event),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice 👍

@kuzhelov kuzhelov merged commit 7ef9da5 into master Apr 5, 2019
@delete-merged-branch delete-merged-branch bot deleted the fix/click-on-menu-item-as-popup-trigger branch April 5, 2019 14:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Menu with toolbarBehavior not keyboard accessible
3 participants