Skip to content
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

Date picker input accessible name is not correct #4730

Closed
filiptammergard opened this issue Sep 6, 2023 · 4 comments · Fixed by #4750
Closed

Date picker input accessible name is not correct #4730

filiptammergard opened this issue Sep 6, 2023 · 4 comments · Fixed by #4750

Comments

@filiptammergard
Copy link
Contributor

What package has an issue

@mantine/dates

Describe the bug

In versions before v6.0.20, the accessible name of <DatePickerInput> was the chosen date, e.g. "September 6, 2023". In v6.0.20, the accessible name is the label of the button. In the example below it's "Pick date".

image

This means that when I use a screen reader to navigate, I'll first come to the label and the screen reader announces "Pick date". Then I go to the button and the screen reader announces "Pick date" again. I can't know what the chosen date is unless I open the date picker input. This is also counter-intuitive, since the accessible name of the button should be the content of the button.

This weird situation comes from that the picker input behaves like an input field, but is a button. When a button has a label above, you'd never expect that the label would trigger the button in the same way as clicking the button. But in this case, it feels like an input field, which would get focus when clicking the label.

Introduced in #4634 that fixed #4616.

What version of @mantine/hooks page do you have in package.json?

6.0.20

If possible, please include a link to a codesandbox with the reproduced problem

https://mantine.dev/dates/date-picker-input/#usage

Do you know how to fix the issue

Yes

Are you willing to participate in fixing this issue and create a pull request with the fix

Yes

Possible fix

I'd probably make sense to revert #4634, and find another way of focusing the input when clicking the label, if that's really intended.

I know there are probably other problems with using an actual <input> for this, but if that's the behavior you're going after, it's a bit problematic to use a <button> instead.

@filiptammergard filiptammergard changed the title Date picker input accessible name Date picker input accessible name is not correct Sep 6, 2023
@rtivital
Copy link
Member

rtivital commented Sep 6, 2023

Do you if it can be fixed by setting aria-label on the button? Reverting is not really a viable option because input is not focused when the label is clicked.

@filiptammergard
Copy link
Contributor Author

Do you if it can be fixed by setting aria-label on the button? Reverting is not really a viable option because input is not focused when the label is clicked.

It should be fixable with aria-label as long as the value of the button can be accessed which I assume. I can give it a go if you want.

@rtivital
Copy link
Member

rtivital commented Sep 6, 2023

Sure, you are welcome to send a PR

@filiptammergard
Copy link
Contributor Author

filiptammergard commented Sep 6, 2023

Why was this input changed from a semantic input to a button in v6? In terms of accessibility, it would definitely be preferable to use a semantic input if that's the behavior you are after.

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

Successfully merging a pull request may close this issue.

2 participants