Closed Bug 1810166 Opened 3 years ago Closed 3 years ago

Blur event isn't triggered when it should with an input date

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED FIXED
112 Branch
Tracking Status
firefox109 --- wontfix
firefox110 --- wontfix
firefox111 --- wontfix
firefox112 --- fixed

People

(Reporter: calixte, Assigned: ayeddi)

References

Details

Attachments

(2 files)

Attached file date.html

STR:

  • open the html;
  • click on the calendar: a blur is triggered but that's fine the relatedTarget is null, hence I can guess this isn't a "real" blur and once I click on a day the input gets back the focus;
  • now click on the calendar, click on the "Month - Year" button, select a year and click somewhere on the screen: the input doesn't have the focus anymore and I've no way to guess that the edition is finished.

When the user clicks outside of the "Month - Year" panel, this panel should be hidden and the input should gets back the focus.

Ideally, I think that no blur should be triggered when we're somewhere in the input UI.

I use the blur event to know that the edition is finished and then I can trigger some validations.

Why doesn't the change or input event fit your use case?

The scenario is the following:

  • when a field is not focused it's a text input containing a formatted value
  • when the field is focused, its type is changed to be a date and then the edition begins
  • on each beforeinput an event is triggered to validate the potential input
  • when the edition is finished (because of a blur for example):
    • an event is triggered in the pdf sandbox with the data to validate/format
    • the input is changed to text
    • the value is changed depending on the format action in the pdf (it can be used to display a date in the US format even if the user uses an other format).

So this bug causes two problems:

  • I can't change the type of the input once the user dismissed the "Month - Year" ui.
  • I can't trigger a specific event to "tell" that the edition is finished (it's required in the PDF specifications).

As far as I can tell, input event only tells me that something has changed.

Severity: -- → S3
Priority: -- → P3

Linked the bug 1812041: blur event is fired when picker is open

Adding tests for the <input type=date> focus handling after a month-year picker panel is opened from the datepicker, the value is changed, and the panel is dismissed. We want to make sure that the input does not blur until the other input is actually focused (and the datepicker is closed).

Depends on D167698

Assignee: nobody → ayeddi
Status: NEW → ASSIGNED
Attachment #9316912 - Attachment description: Bug 1810166 - Ensure date input focus behavior is tested with month-year panel interaction. r=emilio → Bug 1810166 - Ensure date input focus behavior is tested with month-year panel interaction. r?emilio!,mconley,kcochrane
Pushed by ayeddi@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0fb97cb3e32e Ensure date input focus behavior is tested with month-year panel interaction. r=emilio,kcochrane
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch

The patch landed in nightly and beta is affected.
:ayeddi, is this bug important enough to require an uplift?

  • If yes, please nominate the patch for beta approval.
  • If no, please set status-firefox111 to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(ayeddi)
Flags: needinfo?(ayeddi)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: