-
Notifications
You must be signed in to change notification settings - Fork 334
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
Investigate alternative to [type=number] for the date input component #1449
Comments
If collecting dates as numbers, one problem with
There are other issues with Alternative solution (we should test this across the board) is to use
There is also |
We are already using the Possibly another reason to move away from it though. |
To summarise what we know so far: At the minute for the date input component the individual inputs look like this: <input […] type="number" pattern="[0-9]*"> We set the input type to iOS uses the full alphanumeric keyboard for However, there are a number of known issues with inputs of
(Bugs have been filed where appropriate) In testing, using
We think that
|
Once we've done the above, we can also close alphagov/govuk-design-system#782 |
The Design System team have done some accessibility testing on `input type="number"` and deemed them problematic. They have suggested using `input type="text" inputmode="numeric" pattern="[0-9]*"` instead as documented here alphagov/govuk-frontend#1449
The Design System team have done some accessibility testing on `input type="number"` and deemed them problematic. They have suggested using `input type="text" inputmode="numeric" pattern="[0-9]*"` instead as documented here alphagov/govuk-frontend#1449
The Design System team have done some accessibility testing on `input type="number"` and deemed them problematic. They have suggested using `input type="text" inputmode="numeric" pattern="[0-9]*"` instead as documented here alphagov/govuk-frontend#1449
The Design System team have done some accessibility testing on `input type="number"` and deemed them problematic. They have suggested using `input type="text" inputmode="numeric" pattern="[0-9]*"` instead as documented here alphagov/govuk-frontend#1449
The Design System team have done some accessibility testing on `input type="number"` and deemed them problematic. They have suggested using `input type="text" inputmode="numeric" pattern="[0-9]*"` instead as documented here alphagov/govuk-frontend#1449
The Design System team have done some accessibility testing on `input type="number"` and deemed them problematic. They have suggested using `input type="text" inputmode="numeric" pattern="[0-9]*"` instead as documented here alphagov/govuk-frontend#1449
The Design System team have done some accessibility testing on `input type="number"` and deemed them problematic. They have suggested using `input type="text" inputmode="numeric" pattern="[0-9]*"` instead as documented here alphagov/govuk-frontend#1449
The Design System team have done some accessibility testing on `input type="number"` and deemed them problematic. They have suggested using `input type="text" inputmode="numeric" pattern="[0-9]*"` instead as documented here alphagov/govuk-frontend#1449
The Design System team have done some accessibility testing on `input type="number"` and deemed them problematic. They have suggested using `input type="text" inputmode="numeric" pattern="[0-9]*"` instead as documented here alphagov/govuk-frontend#1449 But because `pattern="[0-9]"` causes some browsers to use native error popups which suppress our better error handling we’re going to just add `inputmode="numeric"`
This bug[0] highlights several usability problems with using `type='number'` on the date segment inputs. This change addresses these problems at the expense of removing some client-side validation. [0] alphagov/govuk-frontend#1449
Following report of issues with assistive technologies and compatibility with input `type="number"` [0], this PR will make the recommended changes and convert these input to be of `type="text"` instead, also adding the extra attribute `inputmode="numeric"`. Although this is a very minor change, the version of the gem has been bumped to 4.1.0 as it might be a breaking change for some code, previously relying on the type number. [0] alphagov/govuk-frontend#1449
The recommended way to use the numeric inputs is to be of type `text` but with pattern and inputmode attributes. The dates gem has been updated to produce this new markup [0] following the reports of issues with previous markup [1]. Also updated the `conviction_length` step to produce an input of type `text`, instead of number, and add the `inputmode` attribute. [0] https://github.com/ministryofjustice/gov_uk_date_fields/releases/tag/v4.1.0 [1] alphagov/govuk-frontend#1449
The recommended way to use the numeric inputs is to be of type `text` but with pattern and inputmode attributes. The dates gem has been updated to produce this new markup [0] following the reports of issues with previous markup [1]. Also updated the `conviction_length` step to produce an input of type `text`, instead of number, and add the `inputmode` attribute. [0] https://github.com/ministryofjustice/gov_uk_date_fields/releases/tag/v4.1.0 [1] alphagov/govuk-frontend#1449
Just to confirm that iOS 13 now shows the numeric keypad. |
We've done some investigation to show that now in certain scenarios this is the best way of collecting numeric data from users. We have a bunch of changes to make to roll this out in GOV.UK Frontend: alphagov/govuk-frontend#1449 (comment) After that, we can set this in the input component itself instead of using the `attributes` object. Following our above investigation, GOV.UK Pay introduced this change for collecting credit card details: alphagov/govuk-frontend#1449 They haven't seen any issues so we are sufficiently confident to make the same change in the Design System. This is only applied to sort code and account number as the other data collected is alphanumeric. Tested on iOS 12 and 13, Android 9 and 8.
We've done some investigation to show that now in certain scenarios this is the best way of collecting numeric data from users. We have a bunch of changes to make to roll this out in GOV.UK Frontend: alphagov/govuk-frontend#1449 (comment) After that, we can set this in the input component itself instead of using the `attributes` object. Following our above investigation, GOV.UK Pay introduced this change for collecting credit card details: alphagov/pay-frontend#921 They haven't seen any issues so we are sufficiently confident to make the same change in the Design System. This is only applied to sort code and account number as the other data collected is alphanumeric. Tested on iOS 12 and 13, Android 9 and 8.
@36degrees close this card and create new one with what we want to do |
Closing this as I believe we've finished the investigation and now have cards representing these actions:
|
Within the date input component the individual inputs look like this: ``` <input […] type="number" pattern="[0-9]*"> ``` We set the input to `type="number"` so that Android browsers display a numeric keypad keyboard when the input is focussed. iOS uses the full alphanumeric keyboard for `type="number"`, so we add `pattern="[0-9]*"` which triggers the numeric keypad there too [1]. This is technically invalid HTML, as the pattern attribute only applies to inputs of type `text`, `search`, `url`, `tel` and `email` [2], but is not known to cause any real-world issues. However, there are a number of known issues with inputs of `type="number"`: - they silently discard non-numeric input in Chrome [3] (except the letter 'e') - users can accidentally increment or decrement the number using the arrow keys without realising [4] - users can accidentally increment or decrement the number using the scroll wheel on the mouse or the scroll gesture on their trackpad [5] - they appear as unlabeled in NVDA's element list [6] - in NVDA's object navigation they are seen as a spin button which has an edit field and two buttons inside. Those buttons are unlabeled, but decrease/increase the value [7] - when tabbing to the field NVDA using pressing nvda+tab they are reported as unlabeled edit fields [7] - users of Dragon Naturally Speaking cannot dictate into them as expected [8] (Bugs have been filed where appropriate) In testing, using `<input […] type="text" inputmode="numeric" pattern="[0-9]*">` mitigates these issues, with some minor drawbacks: - Between iOS 12.2 and 13.0, the numeric keypad with punctuation is displayed instead of the numeric keypad. Versions prior to 12.2 do not support `inputmode`, thus fallback to the `pattern` attribute, and continue to show the full numeric keypad. iOS 13 updates inputmode="numeric" to use the numeric keypad without punctuation. - Firefox, UC Browser (and older versions of other browsers) on android support neither `inputmode` nor `pattern`, and so will use the full alphanumeric keypad until those browsers introduce support for `inputmode`. (Note: neither Firefox nor UC browser on Android are listed in our own browser support matrix [9] nor the service manual [10]) --- [1]: http://bradfrost.com/blog/post/better-numerical-inputs-for-mobile-forms/ [2]: https://html.spec.whatwg.org/multipage/input.html#input-type-attr-summary [3]: #1449 (comment) [4]: #1449 (comment) [5]: http://bradfrost.com/blog/post/you-probably-dont-need-input-typenumber/ [6]: alphagov/reported-bugs#41 [7]: nvaccess/nvda#9675 (comment) [8]: alphagov/reported-bugs#34 [9]: https://github.com/alphagov/govuk-frontend#browser-and-assistive-technology-support [10]: https://www.gov.uk/service-manual/technology/designing-for-different-browsers-and-devices#browsers-to-test-in Co-authored-by: Colin Oakley <[email protected]>
Within the date input component the individual inputs look like this: ``` <input […] type="number" pattern="[0-9]*"> ``` We set the input to `type="number"` so that Android browsers display a numeric keypad keyboard when the input is focussed. iOS uses the full alphanumeric keyboard for `type="number"`, so we add `pattern="[0-9]*"` which triggers the numeric keypad there too [1]. This is technically invalid HTML, as the pattern attribute only applies to inputs of type `text`, `search`, `url`, `tel` and `email` [2], but is not known to cause any real-world issues. However, there are a number of known issues with inputs of `type="number"`: - they silently discard non-numeric input in Chrome [3] (except the letter 'e') - users can accidentally increment or decrement the number using the arrow keys without realising [4] - users can accidentally increment or decrement the number using the scroll wheel on the mouse or the scroll gesture on their trackpad [5] - they appear as unlabeled in NVDA's element list [6] - in NVDA's object navigation they are seen as a spin button which has an edit field and two buttons inside. Those buttons are unlabeled, but decrease/increase the value [7] - when tabbing to the field NVDA using pressing nvda+tab they are reported as unlabeled edit fields [7] - users of Dragon Naturally Speaking cannot dictate into them as expected [8] (Bugs have been filed where appropriate) In testing, using `<input […] type="text" inputmode="numeric" pattern="[0-9]*">` mitigates these issues, with some minor drawbacks: - Between iOS 12.2 and 13.0, the numeric keypad with punctuation is displayed instead of the numeric keypad. Versions prior to 12.2 do not support `inputmode`, thus fallback to the `pattern` attribute, and continue to show the full numeric keypad. iOS 13 updates inputmode="numeric" to use the numeric keypad without punctuation. - Firefox, UC Browser (and older versions of other browsers) on android support neither `inputmode` nor `pattern`, and so will use the full alphanumeric keypad until those browsers introduce support for `inputmode`. (Note: neither Firefox nor UC browser on Android are listed in our own browser support matrix [9] nor the service manual [10]) --- [1]: http://bradfrost.com/blog/post/better-numerical-inputs-for-mobile-forms/ [2]: https://html.spec.whatwg.org/multipage/input.html#input-type-attr-summary [3]: #1449 (comment) [4]: #1449 (comment) [5]: http://bradfrost.com/blog/post/you-probably-dont-need-input-typenumber/ [6]: alphagov/reported-bugs#41 [7]: nvaccess/nvda#9675 (comment) [8]: alphagov/reported-bugs#34 [9]: https://github.com/alphagov/govuk-frontend#browser-and-assistive-technology-support [10]: https://www.gov.uk/service-manual/technology/designing-for-different-browsers-and-devices#browsers-to-test-in Co-authored-by: Colin Oakley <[email protected]>
A bit late to this, but I was wondering why |
Thanks for your comment @tempertemper. See #1449 (comment) - iOS 12.2, 12.3 and 12.4 display the keypad with punctuation that you describe but this was fixed in iOS 13 which displays the large numbered keypad with |
@hannalaakso I totally missed that one – I had been testing with iOS 12 so saw the other keyboard. Numeric is perfect 😄 I've attached a couple of screenshots (taken from @adamliptrot-oc's excellent test page) for posterity: the difference is that |
@tempertemper No worries at all, glad we got it figured out 🙂 |
There are some known issues with inputs of type="number". Read our research into the issues with type="number" alphagov/govuk-frontend#1449 (comment)
We are aware of two issues with assistive technologies and their compatibility with [type=number]
We should investigate an alternative to this as we're aware of general issues with [type=number].
@hannalaakso has done a lot of investigation into this.
The text was updated successfully, but these errors were encountered: