Closed Bug 1853797 Opened 2 years ago Closed 1 year ago

showPicker method doesn't work on week and month input

Categories

(GeckoView :: General, defect, P1)

Firefox 117
All
Android
defect

Tracking

(firefox120 wontfix, firefox121 fixed, firefox122 fixed)

RESOLVED FIXED
122 Branch
Tracking Status
firefox120 --- wontfix
firefox121 --- fixed
firefox122 --- fixed

People

(Reporter: lwarlow, Assigned: m_kato)

References

(Regression)

Details

(Keywords: dev-doc-complete, regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Mobile Safari/537.36

Steps to reproduce:

Load https://demo.lukewarlow.dev/showPicker/

Click "date showPicker", "month showPicker" and "week showPicker".

Actual results:

Only the date input picker opened.

Expected results:

All the pickers should have opened like happens when you click on the input itself.

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

For more information, please visit BugBot documentation.

Flags: needinfo?(jonalmeida942)

Once again, thank you jackyzy. :)

I'm going to close it as a duplicate for the linked bug.

Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Duplicate of bug: datetime
Flags: needinfo?(jonalmeida942)
Resolution: --- → DUPLICATE

This isn't a duplicate of that? This is a very specific bug report for Firefox android. Fenix has a week and month input implemented (unlike desktop) it just doesn't have showPicker() implemented for it.

Status: RESOLVED → UNCONFIRMED
No longer duplicate of bug: datetime
Resolution: DUPLICATE → ---

I've reopened this just to make absolutely sure that it's clear this is specific to Android Firefox which already has a month and week input implemented (so the linked bug would seem irrelevant).

Sorry for misleading information.

After some more digging, i found it is a regression of 1824323

Diff: https://phabricator.services.mozilla.com/D173959

Previously, in dom/html/HTMLInputElement.cpp HTMLInputElement::ShowPicker( method : it decide to show via IsDateTimeInputType(mType) , now it use CreatesDateTimeWidget() , CreatesDateTimeWidget is missing InputWeek and InputMonth

bool HTMLInputElement::IsDateTimeInputType(FormControlType aType) {
  switch (aType) {
    case FormControlType::InputDate:
    case FormControlType::InputTime:
    case FormControlType::InputMonth:
    case FormControlType::InputWeek:
    case FormControlType::InputDatetimeLocal:
      return true;
    default:
      return false;
  }
}

and


  static bool CreatesDateTimeWidget(FormControlType aType) {
    return aType == FormControlType::InputDate ||
           aType == FormControlType::InputTime ||
           aType == FormControlType::InputDatetimeLocal;
  }

I tested on Firefox for Android 111.0 , the showPicker button works. So i suggest change condition from CreatesDateTimeWidget back to IsDateTimeInputType

Regressions: 1824323
See Also: datetime

Furthermore , even IsDateTimeInputType is used, MozDateTimeShowPickerForJS still not be triggered , because no shadow root , GetDateTimeBoxElement returns nullptr. https://searchfox.org/mozilla-central/source/dom/html/HTMLInputElement.cpp#5780


Since week/month cannot trigger case "MozOpenDateTimePicker" -> this._handleDateTime(aEvent.composedTarget);
So it should be handled in case "click" -> this._handleClick(aEvent); then https://searchfox.org/mozilla-central/source/mobile/android/components/geckoview/GeckoViewPrompt.sys.mjs#67-72 , but it is early returned here https://searchfox.org/mozilla-central/source/mobile/android/components/geckoview/GeckoViewPrompt.sys.mjs#41-44 because the class of element is "HTMLButtonElement" not the required "HTMLInputElement" / "HTMLSelectElement"

See Also: → 1840668
Component: General → DOM: Core & HTML
Product: Fenix → Core
Component: DOM: Core & HTML → General
Product: Core → GeckoView
Keywords: regression
Regressed by: 1824323
No longer regressions: 1824323
Status: UNCONFIRMED → NEW
Ever confirmed: true

Ah, regression. GeckoView should add gv-junit for prompt.

Assignee: nobody → m_kato

Set release status flags based on info from the regressing bug 1824323

This seems to be a regression by bug 1824323. If we turn on
dom.forms.datetime.others=true, we should dispatch MozOpenDateTimePicker
event simply.

Severity: -- → S3
Priority: -- → P1
Pushed by m_kato@ga2.so-net.ne.jp: https://hg.mozilla.org/integration/autoland/rev/97dbbac0078e HTMLInputElement.showPicker should show the picker on GeckoView even if type is month or week. r=geckoview-reviewers,emilio,ohall
Status: NEW → RESOLVED
Closed: 2 years ago1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 122 Branch

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

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

For more information, please visit BugBot documentation.

Flags: needinfo?(m_kato)

MDN docs for showPicker say we don't support date, month, week. I can see that from 122 we will, but this is marked as a regression, so is there an earlier version where we though it worked?

Keywords: dev-doc-needed

Comment on attachment 9365609 [details]
Bug 1853797 - HTMLInputElement.showPicker should show the picker on GeckoView even if type is month or week. r=#dom-core!,#geckoview-reviewers!

Beta/Release Uplift Approval Request

  • User impact if declined: HTMLInputElement.showPicker for <input type="month"> or <input type="week"> doesn't work from Firefox for Android version 112.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Low. When type attribute of <input> element is month or week, we dispatch an chrome event that is ignored on desktop.
  • String changes made/needed: No
  • Is Android affected?: Yes
Flags: needinfo?(m_kato)
Attachment #9365609 - Flags: approval-mozilla-beta?

Comment on attachment 9365609 [details]
Bug 1853797 - HTMLInputElement.showPicker should show the picker on GeckoView even if type is month or week. r=#dom-core!,#geckoview-reviewers!

Approved for 121.0b9.

Attachment #9365609 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

(In reply to Hamish Willee from comment #14)

MDN docs for showPicker say we don't support date, month, week. I can see that from 122 we will, but this is marked as a regression, so is there an earlier version where we though it worked?

It works from version 101 to version 112. It was broken from 113.

Thanks very much. Just to be clear, is this Android-only, or "Android as well"? I have updated https://github.com/mdn/browser-compat-data/pull/21577 as draft assuming these work everywhere.

Note, on 122.0a1 nightly FF build the selection lists don't work for me on desktop for month or week, which is why I ask. Might not be in that build yet I guess.

Flags: needinfo?(m_kato)

Android only and to be clear this is only relevant for the showPicker function.

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

Attachment

General

Created:
Updated:
Size: