Skip to content

bug: Drawer has poor keyboard accessibility #1939

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

Closed
probablykasper opened this issue Jun 7, 2023 · 3 comments
Closed

bug: Drawer has poor keyboard accessibility #1939

probablykasper opened this issue Jun 7, 2023 · 3 comments
Assignees

Comments

@probablykasper
Copy link

probablykasper commented Jun 7, 2023

What version of daisyUI are you using?

3.0.3

Describe your issue

When tabbing using the drawer, there's no indication of what you're tabbed over.

Additionally, the Navbar menu for desktop + sidebar drawer for mobile example lets you tab into the drawer-toggle checkbox on desktop:

Screen.Recording.2023-06-07.at.09.10.41.mp4

What browsers are you seeing the problem on?

Chrome

Reproduction URL (optional)

No response

@saadeghi
Copy link
Owner

saadeghi commented Jun 7, 2023

As far as I know, there is no solution for this. The hidden checkbox should be before the drawer-content because that's the only way to control the style (unless CSS has() gets a better browser support)
And the label is the only thing that can control the checkbox without using JS but a HTML label can not have CSS :focus-within and it can't be focused so we can't show an outline for it. Instead the hidden checkbox is getting the focus because otherwise there would be no way to open the drawer with keyboard.

Until we get a better browser support with CSS has() the a workaround to improve the accessibility would be using a <button> instead of <label> and check/uncheck the checkbox using JS when button clicked.

@probablykasper
Copy link
Author

probablykasper commented Jun 7, 2023

What about something like this?

input:focus-visible ~ .drawer-content label.drawer-label {
	outline: 2px solid currentColor;
}

For making it not tabbable on desktop, sm:hidden could be added to the input

@saadeghi
Copy link
Owner

saadeghi commented Jun 7, 2023

Good idea. Thanks.
I will try this.

@saadeghi saadeghi self-assigned this Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants