Closed Bug 1848158 Opened 2 years ago Closed 1 year ago

keydown preventDefault not working on <input type="date">

Categories

(Core :: Layout: Form Controls, defect, P3)

Firefox 116
defect

Tracking

()

RESOLVED FIXED
127 Branch
Tracking Status
firefox-esr102 --- unaffected
firefox-esr115 --- wontfix
firefox116 --- wontfix
firefox117 --- wontfix
firefox118 --- wontfix
firefox119 --- wontfix
firefox120 --- wontfix
firefox125 --- wontfix
firefox126 --- wontfix
firefox127 --- fixed

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

Component: Untriaged → DOM: UI Events & Focus Handling
Product: Firefox → Core

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.

Flags: needinfo?(ngkaokis)

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.

Flags: needinfo?(ngkaokis)

The severity field is not set for this bug.
:edgar, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(echen)

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!

Component: DOM: UI Events & Focus Handling → Layout: Form Controls
Flags: needinfo?(echen) → needinfo?(ayeddi)
Severity: -- → S3
Priority: -- → P3

(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.

I tried a couple of possible solutions that we discussed with Jamie, but so far with no luck. Will keep debugging

Assignee: nobody → ayeddi
Flags: needinfo?(ayeddi)

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: ayeddi → nobody
Assignee: nobody → gregp
Status: NEW → ASSIGNED
Pushed by gp3033@protonmail.com: https://hg.mozilla.org/integration/autoland/rev/56526b69c542 Let keydown preventDefault work on <input type=date> r=reusable-components-reviewers,emilio,ayeddi,tgiles
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
Duplicate of this bug: 1571533
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: