Skip to content
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

Improve KuiContextMenu keyboard navigation UX #44

Merged
merged 4 commits into from
Oct 27, 2017
Merged

Improve KuiContextMenu keyboard navigation UX #44

merged 4 commits into from
Oct 27, 2017

Conversation

cjcenizal
Copy link
Contributor

Ports over improvements from elastic/kibana#14434:

  • Refactor focus state logic to use the React lifecycle correctly.
  • Update KuiPopover snapshots.
  • Remove unnecessary isVisible prop from KuiContextMenu.
  • Allow user to both tab AND use the arrow keys for navigation.
  • Reinstate ability to tab and shift-tab to the title of KuiContextMenuPanel.
  • Release focus from Dashboard panel options KuiContextMenu by closing it when you select an option.
  • Update KuiContextMenu example to demonstrate best practice of closing the menu when an item is clicked.
  • Replace native transitionend event handler with onAnimationEnd React event handler.

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

The JS in this is beyond my abilities for review, but the functionality seems to still work. I noticed a small tabbing issue on the last panel and left a few minor comments. Looks good.

Minor tabbing issue that I have trouble replicating...

Note that the title wasn't tabbable until the last attempt (I shift-tabbed to get to it). Also, it's hard to see in the gif, but when it'd tab to the button, it would automatically tab back to the switch (skipping the the title link). Tried another time to replicate this, but couldn't get it running again.

@@ -12,6 +12,10 @@ $euiContextMenuWidth: $euiSize * 16;
}
}

.euiContextMenu__panel {
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks similarly named to .euiContextMenuPanel. Assume they're both needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, because the ContextMenu is what you'll use when there are multiple panels, and it will need to absolutely position them. But when you're just using a ContextMenuPanel by itself, it doesn't need to be absolutely positioned (and shouldn't be, because it will break the layout). I'll leave a comment.

anchorPosition="downLeft"
>
<EuiContextMenuPanel
title="Options"
Copy link
Contributor

Choose a reason for hiding this comment

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

Docs for this example say The below pagination example has no nesting and no title. Might want to remove the title here. Generally I think it's a little redundant functionally. I know I need to make it so the arrow colors correctly when no title is present.

image

Copy link
Contributor

Choose a reason for hiding this comment

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

Made an issue for myself for the coloring. #45

@@ -41,6 +41,7 @@ export default class extends Component {

return (
<EuiPopover
isFocusable
Copy link
Contributor

Choose a reason for hiding this comment

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

Neat! Can you document this prop somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Quick q for you... based on the name, what do you think this prop does? I'm pretty sure I picked an atrocious name.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just knowing how that thing works I'd assume it says whether the content inside traps focus or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haha yeah I picked a bad name. You need to specify it as true only if there is no content inside which is focusable! So maybe I should rename this to nonFocusable or isNotFocusable. Or think of a solution which makes this prop unnecessary.

@cjcenizal
Copy link
Contributor Author

Thanks for the great review @snide! I fixed that tabbing bug and your other feedback. I'll address the isFocusable examples in a subsequent commit once we figure out if it's a suitable name.

@cjcenizal
Copy link
Contributor Author

Added some commits to port over elastic/kibana#14572 and elastic/kibana#14617

@cjcenizal
Copy link
Contributor Author

@snide Could you take another look and give a +1?

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

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

Looks great. ownFocus is my new work routine.

* Refactor focus state logic to use the React lifecycle correctly.
* Update KuiPopover snapshots.
* Remove unnecessary isVisible prop from KuiContextMenu.
* Allow user to both tab AND use the arrow keys for navigation.
* Reinstate ability to tab and shift-tab to the title of KuiContextMenuPanel.
* Release focus from Dashboard panel options KuiContextMenu by closing it when you select an option.
* Update KuiContextMenu example to demonstrate best practice of closing the menu when an item is clicked.
* Replace native transitionend event handler with onAnimationEnd React event handler.
- Support left arrow going back when the panel itself is focused.
[UI Framework] Fix Popover and ContextMenu bugs.
* Rename KuiPopover isFocusable prop to ownFocus. Focus on first focusable element by default.
* Fix bug where ContextMenuPanel keyboard navigation broke if the user was using tab instead of arrow keys.
@cjcenizal cjcenizal merged commit a6e19f0 into elastic:master Oct 27, 2017
@cjcenizal cjcenizal deleted the improvement/accessible-context-menu branch October 27, 2017 19:50
thompsongl pushed a commit to thompsongl/eui that referenced this pull request Mar 30, 2021
`colorMode` key improvements; `computed` dependencies update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants