nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
22.19k stars 1.56k forks source link

[BUG] - NavbarMenu Doesn't Trap Focus #3757

Open xNS5 opened 2 months ago

xNS5 commented 2 months ago

NextUI Version

2.4.6

Describe the bug

The <NavbarMenu/> component doesn't have any built-in focus trap behavior which is throwing off the tab index order as a result. When the navbar menu is open, the user should only be able to focus elements within the menu itself. To implement this behavior, the developer would need to hand-roll their own focus trap which wouldn't really be necessary if the navbar menu were higher in the DOM.

Your Example Website or App

https://nextui.org/

Steps to Reproduce the Bug or Issue

  1. Open https://nextui.org/
  2. Adjust the size of the window until the navbar menu toggle is visible
  3. Open the browser HTML inspector
  4. Toggle the navbar menu button
  5. Attempt to tab to the first element in the list

Expected behavior

As a user, I expect the navbar menu to prevent the user from interacting with any element that isn't contained by the menu. The user should not be able to interact with elements behind the expanded menu.

Screenshots or Videos

NavbarMenu

Operating System Version

Linux, Pop_OS 22.04

Browser

Firefox

Additional Notes

linear[bot] commented 2 months ago

ENG-1360 [BUG] - NavbarMenu renders at bottom of DOM