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

Datepicker Example : Confusion about which day is selected #2646

Open
nicolasbocquet opened this issue Mar 23, 2023 · 2 comments
Open

Datepicker Example : Confusion about which day is selected #2646

nicolasbocquet opened this issue Mar 23, 2023 · 2 comments
Labels
bug Code defects; not for inaccurate prose Example Page Related to a page containing an example implementation of a pattern Feedback Issue raised by or for collecting input from people outside APG task force help wanted Task force is looking for an owner for the issue

Comments

@nicolasbocquet
Copy link

nicolasbocquet commented Mar 23, 2023

Topic

Date Picker Dialog Example

URL

https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/examples/datepicker-dialog/

Steps to reproduce

  1. Open the Datepicker Dialog
  2. Navigate to March, 22 using the arrow keys
  3. Use the space key to select this day
  4. Go to the "next month" button and activate it
  5. Navigate to the "OK" button of the Datepicker using TAB key or SHIFT+TAB key and activate it
  6. 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.

Best regards

@css-meeting-bot
Copy link
Member

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//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

@mcking65 mcking65 added bug Code defects; not for inaccurate prose Example Page Related to a page containing an example implementation of a pattern Feedback Issue raised by or for collecting input from people outside APG task force labels Apr 5, 2023
@mcking65
Copy link
Contributor

mcking65 commented Apr 5, 2023

Based on today's discussion, the proposal for resolving this issue is:

  1. Since this is a single date picker, make selection follow focus.
  2. 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:

  1. The selected date and focused date are always equivalent.
  2. Pressing any of the next/previous buttons both focus and select a date.
  3. Resolve the issue that the selected state is not sufficiently visible.
  4. 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.

@mcking65 mcking65 added the help wanted Task force is looking for an owner for the issue label Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Code defects; not for inaccurate prose Example Page Related to a page containing an example implementation of a pattern Feedback Issue raised by or for collecting input from people outside APG task force help wanted Task force is looking for an owner for the issue
Development

No branches or pull requests

3 participants