Skip to content

[docs][base] Update useMenu and useMenuItem hooks demo #34166

Merged
ZeeshanTamboli merged 8 commits intomui:masterfrom
ZeeshanTamboli:issue/31981-menu-unstyled-base-docs-autfocus-fix
Sep 26, 2022
Merged

[docs][base] Update useMenu and useMenuItem hooks demo #34166
ZeeshanTamboli merged 8 commits intomui:masterfrom
ZeeshanTamboli:issue/31981-menu-unstyled-base-docs-autfocus-fix

Conversation

@ZeeshanTamboli
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli commented Sep 1, 2022

@ZeeshanTamboli ZeeshanTamboli added docs Improvements or additions to the documentation. scope: menu Changes related to the menu. package: @mui/base Specific to @mui/base (legacy). labels Sep 1, 2022
@mui-bot
Copy link

mui-bot commented Sep 1, 2022

No bundle size changes

Generated by 🚫 dangerJS against 8a3cc07

@ZeeshanTamboli ZeeshanTamboli changed the title [docs] Update useMenu and useMenuItem hooks demo [docs][base] Update useMenu and useMenuItem hooks demo Sep 1, 2022
@ZeeshanTamboli ZeeshanTamboli marked this pull request as ready for review September 2, 2022 11:21
Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

Pressing esc should close the menu, similarly to the demos that use the unstyled component

@ZeeshanTamboli
Copy link
Member Author

Pressing esc should close the menu, similarly to the demos that use the unstyled component

Nice catch. Done.

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

One last thing, we should focus the trigger button when the menu closes, again similar to the unstyled component demo, maybe by using something like:

  const close = () => {
    setAnchorEl(null);
    buttonRef.current!.focus();
  };

cc @danilo-leal to check if we need to add some focus indicator styles on the button/menu items.

Copy link
Member

@mnajdova mnajdova 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 thanks! cc @danilo-leal we may wanna revisit the focus styles on the demos in general in the MUI Base docs.

@ZeeshanTamboli ZeeshanTamboli merged commit 17695ff into mui:master Sep 26, 2022
@ZeeshanTamboli ZeeshanTamboli deleted the issue/31981-menu-unstyled-base-docs-autfocus-fix branch September 26, 2022 06:50
alexfauquette pushed a commit to alexfauquette/material-ui that referenced this pull request Oct 14, 2022
daniel-rabe pushed a commit to daniel-rabe/material-ui that referenced this pull request Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation. 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] Menu unstyled page auto focus to useMenu and useMenuItem hooks demo

3 participants