-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(material/sidenav): fix tabindex issue on side mode #30979
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,7 +165,7 @@ export class MatDrawerContent extends CdkScrollable implements AfterContentInit | |
// this was also done by the animations module which some internal tests seem to depend on. | ||
// Simulate it by toggling the `hidden` attribute instead. | ||
'[style.visibility]': '(!_container && !opened) ? "hidden" : null', | ||
'tabIndex': '-1', | ||
'[attr.tabindex]': 'mode === "side" ? null : "-1"', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that it needs to remain focusable, because this logic falls back to it if it can't find any focusable elements inside the content. Maybe it's more appropriate to clear the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clearing the I was thinking that since There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant that you can do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed to this: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I still don't understand why we need to special-case There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like instead of basing the special case off Having '[attr.tabindex]': 'isOpen ? -1 : null' makes sense because you don't need the tabindex attribute when the drawer is closed. However, So it looks like I need to set some logic to where if there are no tabbable elements in the drawer when opened, then the Are there any existing properties or functions that see whether the drawer has tabbable contents? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that we need to cater to the cases where there's no focusable content in the sidenav. It's up to the user to provide some. We should just make sure that the user can't access the content while it's off-screen. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed on making sure the user can't access the content while it's off-screen. However, the root of the issue lies when the side drawer is open and there are focusable elements in the side drawer, there is still a This causes Talkback to focus on the container anytime the user wants to get to the focusable objects in the container due to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we fix it by forwarding focus to the first focusable descendant whenever focus lands on the drawer container? |
||
}, | ||
changeDetection: ChangeDetectionStrategy.OnPush, | ||
encapsulation: ViewEncapsulation.None, | ||
|
Uh oh!
There was an error while loading. Please reload this page.