keydown preventDefault not working on <input type="date">
Categories
(Core :: Layout: Form Controls, defect, P3)
Tracking
()
People
(Reporter: ngkaokis, Assigned: gregp)
References
(Regression)
Details
(Keywords: nightly-community, regression)
Attachments
(2 files)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
Steps to reproduce:
Create a <input type="date"> element and add a keydown event listener and do event.preventDefault()
Actual results:
Even after event.preventDefault(), I can still change the value of <input type="date"> by keyboard
Expected results:
I expect the value of <input type="date"> won't be changed after keydown event.preventDefault is called just like a normal <input> element. And I can only change the date value through the date picker
![]() |
||
Updated•2 years ago
|
![]() |
||
Comment 1•2 years ago
|
||
#1 regression window:
Bug appears when press arrow keys, space key and enter key.
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=99052dd249cc79a752aeed699b8cb4633f3d2cd9&tochange=fe7d9416e64121a3e2b356311b669f2a53052e7b
#2 regression window:
Bug appears when press numeric keys as well as arrow keys, space key and enter key.
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=298997a4d8981f5c275d12bce252856500bfd21f&tochange=ff24539719256b2289b78eea3eed53ebd32ef9a6
Comment 2•2 years ago
|
||
Hi :ngkaokis , what would be the use case for disabling keyboard input in this case?
It does sound to me that limiting a user to only a date picker may create an accessibility barrier for keyboard-only users who do not need a calendar view of the picker and want to and are more familiar with using the spinbuttons of the <input type=date>
field.
An use case would be having a custom text input and integrate with the date picker of <input type=date>
. I just want the date picker feature but sadly that seems we can't use it without the text input on desktop view.
Updated•2 years ago
|
Comment 4•2 years ago
|
||
The severity field is not set for this bug.
:edgar, could you have a look please?
For more information, please visit BugBot documentation.
Updated•2 years ago
|
Comment 5•2 years ago
|
||
keyboard input is handled in https://searchfox.org/mozilla-central/rev/64eef6b342bca86930caf3ba403c0f8ce621b474/toolkit/content/widgets/datetimebox.js#675. Anna, is this something we would like to fix? Thanks!
Updated•2 years ago
|
Comment 6•2 years ago
|
||
(In reply to Edgar Chen [:edgar] from comment #5)
keyboard input is handled in https://searchfox.org/mozilla-central/rev/64eef6b342bca86930caf3ba403c0f8ce621b474/toolkit/content/widgets/datetimebox.js#675. Anna, is this something we would like to fix? Thanks!
My concern is that this use case would be proactively blocking access for keyboard-only users who do not rely on a calendar data to provide their input, thus this was never tested during the a11y improvements work before.
That's being said, web content authors are the ones making decision to provide delightful access to their users with different abilities or not, we probably need to restore the support for this method. I'll keep the NI to get back to it later in the cycle.
Comment 7•2 years ago
|
||
I tried a couple of possible solutions that we discussed with Jamie, but so far with no luck. Will keep debugging
Updated•2 years ago
|
Comment 8•1 year ago
|
||
Resigning from the bug for now since I haven't been able to resolve the issue and don't want to prevent anyone from picking this ticket up.
Assignee | ||
Comment 9•1 year ago
|
||
Updated•1 year ago
|
Comment 10•1 year ago
|
||
Comment 11•1 year ago
|
||
bugherder |
Updated•1 year ago
|
Description
•