-
Notifications
You must be signed in to change notification settings - Fork 97
feat(menus): update Menu/Select Item indentation and focus based on item hover #168
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
Conversation
| /** | ||
| * onMouseMove is used as it is only triggered by actual mouse movement | ||
| */ | ||
| onMouseMove: composeEventHandlers(onMouseMove, () => { |
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.
How come onMouseMove over onMouseEnter the latter would only fire once on entering the menu item.
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.
I originally had onMouseMove then, checked downshift for inspiration...
// onMouseMove is used over onMouseEnter here. onMouseMove
// is only triggered on actual mouse movement while onMouseEnter
// can fire on DOM changes, interrupting keyboard navigation
allisonacs
left a comment
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.
Before approving this, I wanted to flag something: when @jzempel and I met last week on this, I thought we decided to follow native implementation pretty much exactly. In this branch, you can still get into a situation where you have two items hovered/focused (mouse around, then use keyboard—you get the hover/focus both on the moused item, as well as on the item you keyed to. However, the native implementation of menus does not allow two hover/focus states: if you mouse, the hover follows your mouse, and if you then begin keyboarding, the keyboard steals the hover/focus.
I personally find it weird to have the two hover/focus states possible (I thought this was part of the decision to take away the visually distinct hover state).
|
I agree with @allisonacs, the dual styling is a little jarring. This is a side-effect of the |
|
|
fa1f294 to
f376545
Compare
|
I've updated the There is some specificity weirdness, but it seems to be working as expected now. Let me know what you think. |
|
Is it intentional that the old focus state is being used now? |
| /* stylelint-disable */ | ||
| ${props => | ||
| !props.focused && | ||
| `&&&:hover { |
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.
gnarly, but effective!
|
@Austin94 on the demo page if you expand a menu, scroll it off the page, and click a button to expand a different menu ... the page jumps back to the original menu, collapses it, and the 2nd menu does not expand. |
This jumping is due to us returning focus to the element which triggered the menu. It aligns with most of menu implementations, including Material. We could tweak this some though. A few options could be:
|
No, since I was doing a manual publish a fresh |
|
@Austin94 consider a UI like dropbox (web). Expand one of the file menus in the list and then scroll away and expand a different file menu. You definitely wouldn't want the page to scroll back to the originally expanded menu – that would be a bad user experience. Similarly, we wouldn't want to see this kind of experience in a Zendesk table. Furthermore, your Material example isn't ideal (I'd consider it to be an anti-pattern). Move from the "Week" menu over to either the product tray or notifications. The action is immediate. So the behavior isn't consistent in that UI. |
Resolved offline

HeaderItemstyling changes and new focus/hover logicShould also force a breaking change onto all dependent packages; rather than the default lerna behavior of marking it as a patch.
Description
activeprop from a Menu examplecontainsIconproperty forHeaderItemcomponents (iconis a native attribute 😢 )onMouseMoveevent to allow "focus on hover" mechanismChecklist
designer as a reviewer)
component
yarn start)src/index.jsexport