Skip to content

[Menu][base-ui] Focus Menu Items on hover#40755

Merged
michaldudak merged 4 commits into
mui:masterfrom
michaldudak:menu-focus-on-hover
Jan 29, 2024
Merged

[Menu][base-ui] Focus Menu Items on hover#40755
michaldudak merged 4 commits into
mui:masterfrom
michaldudak:menu-focus-on-hover

Conversation

@michaldudak

@michaldudak michaldudak commented Jan 23, 2024

Copy link
Copy Markdown
Member

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 scope: menu Changes related to the menu. package: @mui/base Specific to @mui/base (legacy). labels Jan 23, 2024
@mui-bot

mui-bot commented Jan 23, 2024

Copy link
Copy Markdown

@zanivan zanivan left a comment

Copy link
Copy Markdown
Collaborator

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

@DiegoAndai DiegoAndai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just one comment 😊


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

Copy link
Copy Markdown
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
Copy Markdown
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

@DiegoAndai DiegoAndai left a comment

Copy link
Copy Markdown
Member

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
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: @mui/base Specific to @mui/base (legacy). scope: menu Changes related to the menu.

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