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

Menu enhancements #502

Merged
merged 8 commits into from
Feb 1, 2022
Merged

Menu enhancements #502

merged 8 commits into from
Feb 1, 2022

Conversation

laviomri
Copy link
Contributor

Task
Small improvements and additions around the Menu components. I split it to avoid a larger PR for the incoming MenuGridItem.

@laviomri laviomri requested review from orrgottlieb and a team January 30, 2022 15:24

const NAVIGATION_KEYS = [...ARROW_UP_KEYS, ...ARROW_RIGHT_KEYS, ...ARROW_DOWN_KEYS, ...ARROW_LEFT_KEYS];

export const useLastNavigationDirection = () => {
Copy link
Contributor Author

@laviomri laviomri Jan 30, 2022

Choose a reason for hiding this comment

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

This will be used in the new MenuGridItem, to detect the direction of menu navigation.
Basically I can use it in more existing places and save some code and complexity - maybe I'll do it when I have some time

@@ -226,6 +232,7 @@ const MenuItem = forwardRef(
aria-current={isActive}
onMouseLeave={onMouseLeave}
onMouseEnter={onMouseEnter}
tabIndex={-1}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

there are many manipulation of focus/blur, it's much easier when each menu item is focusable

Copy link
Contributor

Choose a reason for hiding this comment

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

Very small suggestion - -1 kinda feels like a "magic" number, maybe assign it to a constant with a meaningful name?

@@ -226,6 +232,7 @@ const MenuItem = forwardRef(
aria-current={isActive}
onMouseLeave={onMouseLeave}
onMouseEnter={onMouseEnter}
tabIndex={-1}
Copy link
Contributor

Choose a reason for hiding this comment

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

Very small suggestion - -1 kinda feels like a "magic" number, maybe assign it to a constant with a meaningful name?

@laviomri
Copy link
Contributor Author

laviomri commented Feb 1, 2022

@sahariko applied your suggestion 😄

@laviomri laviomri merged commit dbb6566 into master Feb 1, 2022
@laviomri laviomri deleted the feature/omri/menu-enhancements branch February 1, 2022 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants