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][base-ui] Focus Menu Items on hover #40755

Merged
merged 4 commits into from
Jan 29, 2024

Conversation

michaldudak
Copy link
Member

@michaldudak michaldudak commented Jan 23, 2024

Hovering over a menu item focuses it immediately, so we don't have a separate hover and focus states.

I changed the :focus-visible styles to :focus and removed the :hover styles.

Preview: https://deploy-preview-40755--material-ui.netlify.app/base-ui/react-menu/

Closes #40595
Closes #40597

@michaldudak michaldudak added component: menu This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base labels Jan 23, 2024
@mui-bot
Copy link

mui-bot commented Jan 23, 2024

Netlify deploy preview

https://deploy-preview-40755--material-ui.netlify.app/

Bundle size report

Details of bundle changes (Toolpad)
Details of bundle changes

Generated by 🚫 dangerJS against a575cae

Copy link
Contributor

@zanivan zanivan left a comment

Choose a reason for hiding this comment

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

It looks good! I added the fix to the CSS stylesheet too

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 23, 2024
Copy link
Member

@DiegoAndai DiegoAndai left a comment

Choose a reason for hiding this comment

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

Just one comment 😊

@@ -55,6 +55,7 @@ export function useMenuItem(params: UseMenuItemParameters): UseMenuItemReturnVal

const { getRootProps: getListRootProps, highlighted } = useListItem({
item: id,
handlePointerOverEvents: true,
Copy link
Member

Choose a reason for hiding this comment

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

We should add a parameter to useMenuItem to control this so the behavior can be modified. This is required for Material that has different hover and focus states.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jan 25, 2024
Copy link
Member

@DiegoAndai DiegoAndai left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@michaldudak michaldudak merged commit 147db41 into mui:master Jan 29, 2024
22 checks passed
@michaldudak michaldudak deleted the menu-focus-on-hover branch January 29, 2024 15:16
mostafa-rio pushed a commit to mostafa-rio/material-ui that referenced this pull request Feb 3, 2024
Co-authored-by: zanivan <victorzanivan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: menu This is the name of the generic UI component, not the React module! package: base-ui Specific to @mui/base
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[docs][base-ui][Menu] Menu item focus styles [base-ui][Menu] Mouse pointer doesn't steal focus on hover
4 participants