Replies: 7 comments
-
|
Hi @venket469, best practice is:
Example: <div role="dialog" aria-modal="true" aria-label="Choose a date">
<DayPicker mode="single" autoFocus />
</div>A more complex example is here: https://github.com/gpbl/react-day-picker/blob/main/examples/Dialog.tsx If you’re still seeing issues after wrapping + focusing, share a minimal repro and we can check for a bug. |
Beta Was this translation helpful? Give feedback.
-
|
@gpbl If you see this example https://daypicker.dev/guides/input-fields given here for the dialog which is the same code as https://github.com/gpbl/react-day-picker/blob/main/examples/Dialog.tsx. Arrow buttons are not working with NVDA screen reader. I am able to focus to the current day using tab button but not able to move to the other days using Arrow buttons. The example has autofocus and wrapped around the dialog role = 'Dialog' aria-modal='true'. I feel this is a bug. Note: I tried to override the role with value 'application' because I also tried the same approach you suggested above and it did not work. |
Beta Was this translation helpful? Give feedback.
-
|
@venket469 what do you mean with "Arrow buttons are not working"? |
Beta Was this translation helpful? Give feedback.
-
|
@gpbl I mean I am able to focus to current date, not able to navigate to other dates using arrow up/ arrow down/ arrow right/ arrow left when the NVDA screen reader is on. |
Beta Was this translation helpful? Give feedback.
-
|
@venket469 thanks for clarifying. It could be that NVDA is using these keys for browsing instead of focusing on the buttons in the calendar. What happens if you keep the dialog role in the container AND add the application role (with aria-label) to DayPicker? I am currently unable to test NVDA, so I cannot try it myself... |
Beta Was this translation helpful? Give feedback.
-
<div
role="dialog"
aria-modal="true"
aria-label={"Calendar Container"}
>
<DayPicker
autoFocus
role='application'
aria-label={'-'}/>
</div> |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for the update @venket469! I will update the docs accordingly. I think this is the correct way to make it work. There's nothing wrong with having an aria-label for the dialog and one for the calendar. I suggest using the dialog's header as the dialog label, and something like "Calendar, December 2025" for the DayPicker. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am currently exploring to use react-day-picker in a popup/modal like UI below a input field. When I set role=dialog and aria-label for the react-day-picker, NVDA screen reader does not reads the selected element properly and also keyboard arrow functions are not working at all in UI. But when I set react-day-picker role=application its working perfectly fine. But since I am using modal like UI, I thought of using role=dialog. Let me know if I am something or if this is a bug.
Beta Was this translation helpful? Give feedback.
All reactions