Navigate to the "OK" button of the Datepicker using TAB key or SHIFT+TAB key and activate it
Datepicker is now closing and the input date is showing April, 22 instead of your own selection of March, 22 from step 2 and 3
Notes
In this context, it seems there is no information conveying which date will be taken into account when activating the "OK" button, be it March, 22 or April, 22.
Also, selecting an item manually using the space key is something that we chose personally. So, it is somewhat confusing that this item would be replaced.
The ARIA Authoring Practices (APG) Task Force just discussed Date picker date selection issue.
The full IRC log of that discussion
<jugglinmike> Topic: Date picker date selection issue
<jugglinmike> github: https://github.com/w3c/aria-practices/issues/2646
<jugglinmike> Matt_King: I didn't know if we wanted to try to fit this in
<jugglinmike> Matt_King: It's about the Date Picker Dialog
<jugglinmike> Matt_King: This is interesting because in this example, the selection doesn't follow the focus, but if you press "Enter", it does select and close.
<jamesn> q+
<jugglinmike> Matt_King: I'm curious if people here thinks this is a bug or not
<jugglinmike> Matt_King: In this particular case, the user is moving the date that has focus by pressing the "next month" button, but doesn't ever directly focus on that date
<jugglinmike> jamesn: I think it's not a bug. It seems like there is a bug here in that this date picker is not doing what the keyboard says it should do when you press "space" on the date grid. I'm not sure I agree with what it says it should do
<jugglinmike> jamesn: Visually, selection follows focus
<jugglinmike> jamesn: It seems to me that there's no point in selecting a different date from the one the focus is on (in this example)
<jugglinmike> jamesn: I didn't even see that there was a style in the one that you press "space" on--it's visually very subtle
<jugglinmike> Matt_King: So it seems like the bug here is a design problem. That really, selection should be following focus, period
<jugglinmike> jamesn: That's what the keyboard instructions say
<jugglinmike> CurtBellew: If you cancel it, it goes back to the default, right?
<jugglinmike> Matt_King: That's right
<jugglinmike> Matt_King: If I choose April 1st, and then I go into the dialog and move all around and even choose another, when I hit cancel, it should go back to April 1st
<jugglinmike> jamesn: That's not how it's behaving right now
<jugglinmike> Matt_King: So "Space" is actually changing the value of the input
<jugglinmike> jamesn: That's right
<jugglinmike> Matt_King: But "cancel" isn't really undoing things, here
<jugglinmike> CurtBellew: No, not when the space bar is involved
<jugglinmike> Matt_King: As an aside--we should probably do a "date range" selector at some point, too.
<jugglinmike> jamesn: So is this a documentation bug, or do we want to change the focus model?
<jugglinmike> Matt_King: I'm inclined toward the latter
<jugglinmike> jamesn: Me too, it would simplify things
<jugglinmike> Matt_King: So, we propose to make Space and Enter behave the same way when the focus is on the grid. That would make it impossible to get into this situation
<jugglinmike> Matt_King: Right now, I have April 6th in the input field. If I go into the dialog and tab to the button right after "Okay" which is "Previous Year". If I press that button, I assume it's on April 6. If I back-tab, I expect it to read April 6. And it did
<jugglinmike> Matt_King: So the focus never changed
<jugglinmike> Matt_King: We already have a problem where the difference between "focused" and "selected" isn't clear, visually. We don't have to solve that here.
<jugglinmike> Matt_King: There are some related pull requests in review, but since they're almost done, we'll address this with a new pull request
Based on today's discussion, the proposal for resolving this issue is:
Since this is a single date picker, make selection follow focus.
Implement the behavior documented for the Space key, i.e., it activates the OK button if focus is on a date.
The above changes ensure that:
The selected date and focused date are always equivalent.
Pressing any of the next/previous buttons both focus and select a date.
Resolve the issue that the selected state is not sufficiently visible.
Resolve the currently ambiguous behavior of cancel that occurs if space is pressed on a date before cancel is pressed. Cancel should always return the input to the state it was in before the dialog was opened.
Topic
Date Picker Dialog Example
URL
https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/examples/datepicker-dialog/
Steps to reproduce
March, 22
using thearrow keys
space key
to select this dayTAB key
orSHIFT+TAB key
and activate itApril, 22
instead of your own selection ofMarch, 22
from step 2 and 3Notes
In this context, it seems there is no information conveying which date will be taken into account when activating the "OK" button, be it
March, 22
orApril, 22
.Also, selecting an item manually using the
space key
is something that we chose personally. So, it is somewhat confusing that this item would be replaced.Best regards