You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 27, 2021. It is now read-only.
Navigate to a wildcard profile route like /profile/hello and then open the menu. This throws Uncaught Error: You can't have a focus-trap without at least one focusable element. Then it becomes impossible to close the menu.
If we set selected on a route, then it works. But in the case where we have a route that doesn't have a menu item nothing gets selected and we get the focus trap error. One option is adding tabindex, which also makes the menu work with tabs and enter. I'm doing something like this in a project right now. I can make a PR if you'd like to add it into this template.
<Drawermodalref={this.drawerRef}><Drawer.DrawerContent><Drawer.DrawerItemselected={props.selectedRoute==="/"}onClick={this.goHome}onKeyDown={({ keyCode })=>{keyCode===13&&this.goHome();}}tabindex={0}role="link"><List.ItemGraphic>home</List.ItemGraphic>
Home
</Drawer.DrawerItem><Drawer.DrawerItemselected={props.selectedRoute==="/profile"}onClick={this.goToMyProfile}onKeyDown={({ keyCode })=>{keyCode===13&&this.goToMyProfile();}}tabindex={0}role="link"><List.ItemGraphic>account_circle</List.ItemGraphic>
Profile
</Drawer.DrawerItem></Drawer.DrawerContent></Drawer>
Or if we don't care about tabbing we can just wrap the whole thing in an element with tabindex={0}, but that probably breaks accessibility.
Navigate to a wildcard profile route like
/profile/hello
and then open the menu. This throwsUncaught Error: You can't have a focus-trap without at least one focusable element
. Then it becomes impossible to close the menu.This error is coming from the
focus-trap
package used by MDC. The function is here: https://github.com/davidtheclark/focus-trap/blob/7ea336379d3c292c02fd904564c08d8370ecb1b5/index.js#L158If we set
selected
on a route, then it works. But in the case where we have a route that doesn't have a menu item nothing getsselected
and we get the focus trap error. One option is addingtabindex
, which also makes the menu work with tabs and enter. I'm doing something like this in a project right now. I can make a PR if you'd like to add it into this template.Or if we don't care about tabbing we can just wrap the whole thing in an element with
tabindex={0}
, but that probably breaks accessibility.The text was updated successfully, but these errors were encountered: