-
Notifications
You must be signed in to change notification settings - Fork 355
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
Develop example of date picker design pattern using a combobox that opens a dialog #34
Comments
I'm taking a pass at this now. |
FWIW, there's a solid example of this marked up already at http://www.oaa-accessibility.org/example/15/. Is it worth reaching out to the author to reuse their example here? |
@jongund @a11ydoer is the code at http://www.oaa-accessibility.org/example/15/ either of yours? |
For issue #34, add a directory for datepicker examples and a first cut of code.
Here is the initial cut of an example page by @jongund merged into the issue34-date-picker-examples branch with commit 5d16101. Rather than immediately tackling issue #57, this example could work as an example for the combobox pattern. That pattern needs an example of a combobox that pops up a dialog. |
@mcking65 I have pushed a new version of the datepicker example. I had to rewrite most of the code, but it should be much easier to make modifications to the example with the new code base. |
Per discussion in today's meeting, issues that need further discussion:
|
Hi,
Directions:
Personally, I think the keyboard functionality and screen reader feedback is very helpful, and this design pattern is already accessible in JAWS12 through 2019 and in NVDA using IE11, Firefox, and Chrome Canary. Some notes, this is not implemented as a combobox because for this, it doesn't need to be. Also, within this design pattern, you will notice that the external toggle button is also in the tab order. Though it can be taken out using tabindex="-1", I don't recommend this as a practice, because there is no guarantee that sighted keyboard only users will always be aware that they can press the Down arrow on the input field to move focus into the date picker, and having an explicit button for this purpose guarantees accessibility for all user types regardless. The code for these widgets can be found within the Coding Arena in the download at Best wishes, |
As a quick update, others at Level Access have been testing the same design pattern I shared here, and behaviorally it does appear to be a reliable one. There were only a few issues with unreliable user expectations, where it wasn't clear that pressing the Down arrow was the expected keystroke for moving focus into the calendar. As a general paradigm however, and with proper visual indicators such as an arrow icon and the like for making it clear when the input field has focus that pressing 'down' is an option, most of this can be addressed by general public exposure and basic training for using these types of widgets, as long as we can establish a general keyboard pattern that we agree upon and publicize clearly. A quick note regarding the examples I recently posted: At present I have these set not to show onFocus when a touch device is detected, because I’m not sure how disruptive that would be for mobile device users, which unfortunately includes all desktops with touch-support monitors like hybrid laptops. I haven’t found a simple way of differentiating these reliably as yet. This is something we are going to have to keep in mind for all of our widgets though, because the keyboard paradigm does not always port equally over into touch, especially when some devices do both such as hybrid laptops. This is another reason why it is important to ensure that the extra triggering element remains in the tab order, to account for those who cannot access the standard event trigger when this is focus-based. |
@jongund, here is a summary of today's discussion ...
It should return to the edit field and close the dialog. For most devices and assistive tech, this is the best experience. One compromise is that this does have the downside that it may re-display a touch keyboard.
Display the dialog when:
Close the dialog when:
Move keyboard focus into the dialog when:
|
Is it possible we could prevent unwanted display of the touch keyboard when a date is chosen by detecting when a date is chosen by touch? That is, if a date is touched and the dialog is closed, place focus on the down arrow icon. However, if a date is chosen via the keyboard or mouse click, put focus in the text field. If we did this, we would want the accessible description of the down arrow icon to reference the text field. I am assuming the accessible name would be "Open calendar." |
Hi, James, I tried to locate the test urls you sent me, but I couldn't access this in my IRC history and it doesn't appear to be in the meeting minutes. Either way though, I understand your points about having a need to display the date picker on touch without showing the virtual keyboard, and I have already solved this without requiring focus redirection to do so. A few notes about the changes.
Test urls
Explanation As a general design pattern, we should not rely upon focus movement hacks to either display or not display specific platform features like virtual keyboards. Instead, we should keep focus in a predictable and accessibility approved location and update functionality accordingly using the attached events for whatever widget currently has focus. This can be done by modifying the event order of precedence when triggered on the input field, and it does not require setting focus to inactive parent elements to trick the browser into doing something different. The above examples show the results of this methodology, and the only technique that is being used is the utilization and conditional processing of specific attached events on the input field. Specifically, these include the ontouchstart and onfocus event handlers. The ontouchstart handler is always processed before the display of a virtual keyboard, and if returned false (event.preventDefault) is used to cancel this handler, then it will not display the virtual keyboard on the screen, and this event will only fire when the input field is touched using a touch screen. If ontouchstart is canceled, then the onFocus event will not fire either. So, to achieve the same logic on an auto-opening calendar when focus is set to an editable input field, do the following.
Every time a calendar is rendered, preferably within a callback for this purpose, aria-expanded needs to be set on the input field to convey the active state of this calendar for non-sighted screen reader users. Also, if a separate triggering element is present that can be used as a toggle like in the examples above, these too need to include aria-expanded to convey the same thing, since both control the same calendar, and the triggering element that has focus must convey its active state regardless which one it is. I've also had these example design patterns extensively reviewed internally, and to ensure accessibility for sighted keyboard only users, it is necessary to include a dynamically updated visual indicator such as an arrow icon to convey that the user can press the Down arrow when the input has focus to then move focus into the calendar for navigation. Also, a clear visual indicator does not have to be normalized for different languages like a plain text message would have to be. By combining all of these things as I did, you can indeed create a reliable and provably accessible auto-renderrable date picker that works across both desktop and touch devices equally within the same design pattern; without having to include focus movement hacks to disrupt native functionality within mobile devices. To review the code for these widgets, it has already been added to |
Hi, Apparently, for sighted keyboard only users, it can be confusing to only provide Down arrow access into the calendar, because this is not an expected widget type like a list or menu as dropdowns are styled as. As such, the recommended fix is to provide Down arrow as the intended method for doing this, however pressing Tab will also set focus into the calendar when expanded, which allows all user types to most accessibly use this widget type with the least amount of confusion. Escape can still close the calendar as before to allow keyboard users to continue navigation as expected as well. Also, pressing Shift+Tab will automatically close the calendar when focus is still on the editable input field. For testing, this functionality has been added to the live demo at |
Sorry if I missed this somewhere in the comments, but some programatically associated keyboard instructions for screen reader reliant users e.g. maybe with aria-describedby might help a lot in ensuring a minimum of problems for users encountering this for the first time. |
@accdc I like that example, but for some reason, when using NVDA and Firefox, I get the following behavior:
I really like this functionality as a calendar though. @pbossley yes,, there should be something similar to "pres down arrow to view calendar", but it is not a very big deal as long as there is a button in the next index that when clicked will open the calendar. |
Thanks @frastlin, I also reproduced the arrowing you mentioned in NVDA, and this is a combination of things, not so easily addressed for this type of auto-opening widget. The way that the input field works, is by using an onFocus handler to auto render the date picker visually, and this is necessary for sighted keyboard only users. However, NVDA, when arrowing down the page in Browse Mode, will automatically trigger the onFocus handler upon any element that has one attached, which is why the calendar is auto-opening when you read it without entering Applications Mode first as it does when you press Tab instead. So, this is why when you press Down again you arrow passed the edit field instead of opening the calendar as you would expect. For this to work in NVDA, you would have to press Enter on the edit field first to enter Applications Mode before you use the Down arrow to set focus into the calendar. Unfortunately there appears to be no way to prevent NVDA from doing this auto-onFocus triggering prematurely, which is another reason why it is important to make sure there is a second button-like triggering element that performs the same action next to the input field, so that non-standard keystrokes and unexpected circumstances like these can be circumvented by manually activating the associated toggle button instead. |
NVDA still says something about a new dialogue every month. |
Hi @frastlin, With some experimentation, I was able to track down an order of events that allows for NVDA to auto-close the calendar when arrowing. So, you can now arrow down the page using NVDA + Firefox in Browse Mode, and when you arrow past the edit field it will automatically close the calendar. This means, however, that you will have to manually activate the trigger button in order to open the calendar if you go past the focusable edit field. Also, I changed which elements are exposed in the accessibility tree, and which ones have accessible names, so you should now find it much less verbose when switching between months. You will still hear the word 'dialog' however, but this is something that NVDA does automatically when focus is set within an ARIA dialog widget, and this is impossible to turn off. Even so though, you should find that the feedback is more understandable. I also disabled the announcement of table feedback which had to do with exposed element structures in the accessibility tree, since the column and row counts were not actually helpful in any way when announced as part of this navigation. Relevant test pages: Does this work better for you? |
yes, that's almost perfect. The only thing is that the aria-expanded attribute doesn't show collapsed when I arrow down to the button. Everything else works perfectly. |
Please see the following comments regarding the date picker: |
Siri,
When the focus is in the textbox and the calendar is not showing, the calendar should open using the down arrow key as part of the combobox design pattern.
https://raw.githack.com/w3c/aria-practices/issue34-date-picker-examples/examples/datepicker/datepicker.html
Jon
From: Shirisha Balusani <notifications@github.com>
Sent: Saturday, March 30, 2019 7:08 PM
To: w3c/aria-practices <aria-practices@noreply.github.com>
Cc: Gunderson, Jon R <jongund@illinois.edu>; Mention <mention@noreply.github.com>
Subject: Re: [w3c/aria-practices] Develop example of date picker design pattern using a combobox that opens a dialog (#34)
Please see the following comments regarding the date picker:
• Format (mm/dd/yy) is present in the form of a placeholder.
• NVDA/Firefox and NVDA/Chrome skips the "Date" heading, the date input field and the "pick a date" button in virtual mode.
• In IE11, user is unable to access the calendar dialog via keyboard or JAWS. The dialog is not opened when the user tabs to input field.
• JAWS/IE11 narrates the date input field as "date link".
• JAWS/IE11 narrates the "pick a date" button as combo box dialog in virtual mode.
• Keyboard only and screen reader user is unable access the date picker dialog once the dialog is closed via [esc] or "cancel" button. They have to tab out of the input field and tab back to it to access the dialog.
• "Pick a date" button does not pass the required color contrast ratio of 3:1
• Keyboard user and screen reader users (in forms mode) unable to access the "Pick a date" button as it has tabindex of "-1"
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#34 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ABcE7Ny70Vp4oR2xZJ1z1-XKBOLzEy8Pks5vb_xEgaJpZM4ITfeK>.
|
Nice prototype! A couple of comments:
|
BTW, @mcking65 , I recognized your fingerprints all over this. Takes me back to a few sessions we spent on this at IBM. |
Updated example by @jongund This will be discussed at ARIA -APG meeting on May 21, 2019 |
From the meeting: one of the questions was whether the supplemental button next to the input should exist as a semantic button. Keeping it a There is already the guideline that there should be one tab stop for the control. Should there also be pattern guidance for only exposing one semantic form control per combobox? |
In the current example the keyboard pops up on iOS when selecting a date in the calendar. Suggest not moving focus to the text field to avoid this problem. |
* Add Initial Cut of Date Picker Example (pull #839) For issue #34, add a directory for datepicker examples and a first cut of code. * Date Picker Example: Add link to development issue * updated datepicker example and documentation * fixed broken reference * made updates to the documentation * made updates to the documentation * made updates to the documentation * made updated code * updated example * updated code * fixed problem with document clicks when date picker is open * fixed problem with document clicks when date picker is open * updated month year title * improved source code documentation * focus returns to textbox and added Home and End key commands for first and last day of the week * edited description of example * updated documentation * updated documentation * updated documentation * fixed some bugs * fixed some bugs * removed some debugging code * validated js and css code * fixed bug * added two regression tests * updated keyboard behavior for opeing the datepicker * updated date picker example to support keyboard announcements * updated date picker example to support keyboard announcements * updated date picker example to support keyboard announcements * added down arrow key * fixe bug with onclick * updated click event on date to put date in textbox and close dialog * down arrow appears on input focus * updated click behaviors for input and calendar button * updated datepicker document click event to handle clicking in textbox * updated datepicker document click event to handle clicking in textbox * updated code for down arrow in textbox * updated example CSS * updated code for down arrow in textbox * fixed bug with document click event for dialog * fixed interation bugs and added accessibilty feature description * updated documentation, fied bugs and added a menu button date picker * fixing mouse interaction issues * fixed mouse bugs with date picker example * cleaning up some of the code * added feature to move to the next or previosu month when clicking on a disabled date * changed header cells from using aria-label to abbr attribute * fixed bugs with buttons for changing the next/previous year and month buttons * fixed bug with next/previous buttons when focus is in the textbox * created intial example of menu button for opening date picker * added a file to support spin buttons * initial implementation of a datepicker using spin buttons * added documenation about values wrapping for day and month * added documenation about values wrapping for day and month * button label is updated with current date information * button label is updated with current date information for combobox too now * Move spinbutton and combobox examples Moved the combobox datepicker to the aria 1.1 combobox directory. Move the spinbutton date picker to new branch issue125-spinbutton-datepicker-example. * Remove files copied to new issue1046-datepicker-dialog branch * updating example to be compatible with date gird used in dialog date picker example * fixed css bug * added message live region to dialog * fixed some bugs related to messages * updated documentation on live regions * updated regression test file for noew location of example and added a few tests for combobox * removed aria-controls from buttons in the dialog to change the month/year and updated the file names to be compatible with other combox file names * test commit * test commit 2 * updated date picker code to use the Date object like the datepicker dialog example * improved code by adding helper functions and removing a redundant function * updated file name to be consistent wih other examples * restored previous file name for compatibility with ava testing * improved code readibility by using helper function to test if same month * removed some unused variables * removed unused properties and used helper function to compare days * updated docuemntation and added ids for developing regression tests * started integration of dialog box regression tests * button label now updates with the selected date information * updated link to provide feedback to point to th epull request * removed aria-expanded from button * updated method names to be more consistent and descriptive * updated documentation * updated documentation * updated documentation * updated documentation * updated properties to move role and arai-expanded to input box, changed aria-owns to aria-controls and removed disabled days form the date grid * updated some of the tests * updated tests and fixe a tabindex bug * removed some unused code * removed unused functions * updated CSS for hding disabled dates * fixed data-date attribute computation * fixed html validation bugs * fixed some bugs * restored * restored * restored * updated test cases * Change version in title and footer from 1.1 to 1.2 * changes file name * updated code * fixed bug with last row being shown * added updating button label based on selected date * This test is no longer needed * changed design to remove buttons from gridcells * Added role gridcell to support validator bug for not recognizig `td` in contect of a `role=grid` as a `gridcell` * improved high contrast of combobox buton svg image * added role=groidcell to pass html validator * fixed bug with aria-selected * fixed bug with aria-select following focus * separated space and enter behavior and fixed bug with focus on combobox when page loads * Updated links to source files * Fixed broken link * updated tests and added keyboard event for button * updated test using the SPACE key * updated focus styling * Apply editorial suggestions from code review by @carmacleod Co-Authored-By: Carolyn MacLeod <Carolyn_MacLeod@ca.ibm.com> * updated focus styling to use solid borders * updated styling of date with tabindex=0 * updated regression tests coverage to inlcude missing tests * removed reference to undefined object * Add missing data-test-id for tabindex=-1 * Add test for month-year-button-space-return * removed code to update button with the current date * Fix an assertion in the month-year-button-space-return test * Use await where appropriate Tests were sometimes passing and sometimes failing in CI. I think the reason may be that the code wasn't using await consistently. * fixed regression test to use Key.SPACE instead of space character * made improvements to high contrast support * updating regression tests * updated regression test to use queryElements and remove t.plan, but getting rejected promise errors * updated documentation on high contrast support * updated documentation on high contrast support * updated documentation on high contrast support * updated documentation on high contrast support * Fix tests to use queryElements correctly * Fix spelling errors caught by npm run lint:spelling * Add stubs for missing tests * removed code for an unused live region for a combobox message Co-authored-by: Matt King <a11yThinker@gmail.com> Co-authored-by: Carolyn MacLeod <Carolyn_MacLeod@ca.ibm.com> Co-authored-by: Simon Pieters <zcorpan@gmail.com>
* Add Initial Cut of Date Picker Example (pull #839) For issue #34, add a directory for datepicker examples and a first cut of code. * Date Picker Example: Add link to development issue * updated datepicker example and documentation * fixed broken reference * made updates to the documentation * made updates to the documentation * made updates to the documentation * made updated code * updated example * updated code * fixed problem with document clicks when date picker is open * fixed problem with document clicks when date picker is open * updated month year title * improved source code documentation * focus returns to textbox and added Home and End key commands for first and last day of the week * edited description of example * updated documentation * updated documentation * updated documentation * fixed some bugs * fixed some bugs * removed some debugging code * validated js and css code * fixed bug * added two regression tests * updated keyboard behavior for opeing the datepicker * updated date picker example to support keyboard announcements * updated date picker example to support keyboard announcements * updated date picker example to support keyboard announcements * added down arrow key * fixe bug with onclick * updated click event on date to put date in textbox and close dialog * down arrow appears on input focus * updated click behaviors for input and calendar button * updated datepicker document click event to handle clicking in textbox * updated datepicker document click event to handle clicking in textbox * updated code for down arrow in textbox * updated example CSS * updated code for down arrow in textbox * fixed bug with document click event for dialog * fixed interation bugs and added accessibilty feature description * updated documentation, fied bugs and added a menu button date picker * fixing mouse interaction issues * fixed mouse bugs with date picker example * cleaning up some of the code * added feature to move to the next or previosu month when clicking on a disabled date * changed header cells from using aria-label to abbr attribute * fixed bugs with buttons for changing the next/previous year and month buttons * fixed bug with next/previous buttons when focus is in the textbox * created intial example of menu button for opening date picker * added a file to support spin buttons * initial implementation of a datepicker using spin buttons * added documenation about values wrapping for day and month * added documenation about values wrapping for day and month * button label is updated with current date information * button label is updated with current date information for combobox too now * Move spinbutton and combobox examples Moved the combobox datepicker to the aria 1.1 combobox directory. Move the spinbutton date picker to new branch issue125-spinbutton-datepicker-example. * Remove files copied to new issue1046-datepicker-dialog branch * updating example to be compatible with date gird used in dialog date picker example * fixed css bug * added message live region to dialog * fixed some bugs related to messages * updated documentation on live regions * updated regression test file for noew location of example and added a few tests for combobox * removed aria-controls from buttons in the dialog to change the month/year and updated the file names to be compatible with other combox file names * test commit * test commit 2 * updated date picker code to use the Date object like the datepicker dialog example * improved code by adding helper functions and removing a redundant function * updated file name to be consistent wih other examples * restored previous file name for compatibility with ava testing * improved code readibility by using helper function to test if same month * removed some unused variables * removed unused properties and used helper function to compare days * updated docuemntation and added ids for developing regression tests * started integration of dialog box regression tests * button label now updates with the selected date information * updated link to provide feedback to point to th epull request * removed aria-expanded from button * updated method names to be more consistent and descriptive * updated documentation * updated documentation * updated documentation * updated documentation * updated properties to move role and arai-expanded to input box, changed aria-owns to aria-controls and removed disabled days form the date grid * updated some of the tests * updated tests and fixe a tabindex bug * removed some unused code * removed unused functions * updated CSS for hding disabled dates * fixed data-date attribute computation * fixed html validation bugs * fixed some bugs * restored * restored * restored * updated test cases * Change version in title and footer from 1.1 to 1.2 * changes file name * updated code * fixed bug with last row being shown * added updating button label based on selected date * This test is no longer needed * changed design to remove buttons from gridcells * Added role gridcell to support validator bug for not recognizig `td` in contect of a `role=grid` as a `gridcell` * improved high contrast of combobox buton svg image * added role=groidcell to pass html validator * fixed bug with aria-selected * fixed bug with aria-select following focus * separated space and enter behavior and fixed bug with focus on combobox when page loads * Updated links to source files * Fixed broken link * updated tests and added keyboard event for button * updated test using the SPACE key * updated focus styling * Apply editorial suggestions from code review by @carmacleod Co-Authored-By: Carolyn MacLeod <Carolyn_MacLeod@ca.ibm.com> * updated focus styling to use solid borders * updated styling of date with tabindex=0 * updated regression tests coverage to inlcude missing tests * removed reference to undefined object * Add missing data-test-id for tabindex=-1 * Add test for month-year-button-space-return * removed code to update button with the current date * Fix an assertion in the month-year-button-space-return test * Use await where appropriate Tests were sometimes passing and sometimes failing in CI. I think the reason may be that the code wasn't using await consistently. * fixed regression test to use Key.SPACE instead of space character * made improvements to high contrast support * updating regression tests * updated regression test to use queryElements and remove t.plan, but getting rejected promise errors * updated documentation on high contrast support * updated documentation on high contrast support * updated documentation on high contrast support * updated documentation on high contrast support * Fix tests to use queryElements correctly * Fix spelling errors caught by npm run lint:spelling * Add stubs for missing tests * removed code for an unused live region for a combobox message Co-authored-by: Matt King <a11yThinker@gmail.com> Co-authored-by: Carolyn MacLeod <Carolyn_MacLeod@ca.ibm.com> Co-authored-by: Simon Pieters <zcorpan@gmail.com>
Add a mobile-compatible example of a date picker that employs the form of the ARIA 1.1 combobox pattern that pops up a dialog.
Completing this issue will also complete issue #534.
Development is in the issue34-date-picker-examples branch. Use that branch as the base for pull requests related to this issue.
Preview link for feature branch
Date picker combobox example in feature branch
Related to issue #57.
The text was updated successfully, but these errors were encountered: