Add showPicker() to <input> elements
Categories
(Core :: DOM: Forms, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox101 | --- | fixed |
People
(Reporter: beaufort.francois, Assigned: evilpie)
References
(Blocks 2 open bugs)
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
Steps to reproduce:
The showPicker() method is a new addition to HTMLInputElement which addresses a very common request from web developers: programmatically showing a picker for controls like date etc.
<input id="dateInput" type="date">
<button onclick="dateInput.showPicker()">Show the date picker</button>
WHATWG Spec PR: https://github.com/whatwg/html/pull/7319
Updated•2 years ago
|
Updated•2 years ago
|
Reporter | ||
Comment 1•1 year ago
|
||
I've added MDN doc for this feature at https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/showPicker
See https://github.com/mdn/content/commits/main/files/en-us/web/api/htmlinputelement/showpicker/index.md
Comment 2•1 year ago
|
||
This has been fixed in WebKit now: https://bugs.webkit.org/show_bug.cgi?id=237192
Reporter | ||
Comment 3•1 year ago
|
||
Note that WebKit patch does not cover date pickers yet. Only file and color from what I've seen.
See https://twitter.com/quicksave2k/status/1508382939834470410
Updated•1 year ago
|
Comment hidden (obsolete) |
Updated•1 year ago
|
Updated•1 year ago
|
Assignee | ||
Updated•1 year ago
|
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/fa6795d107b1 Add showPicker() to <input> elements. r=emilio
Comment 6•1 year ago
|
||
Backed out for causing multiple failures. CLOSED TREE
Backout link: https://hg.mozilla.org/integration/autoland/rev/c99a0223fbd3bc7140c79e3d182415831093ccff
Link failure logs:
https://treeherder.mozilla.org/logviewer?job_id=374318488&repo=autoland&lineNumber=5110
https://treeherder.mozilla.org/logviewer?job_id=374323849&repo=autoland&lineNumber=23379
https://treeherder.mozilla.org/logviewer?job_id=374321347&repo=autoland&lineNumber=6600
Assignee | ||
Comment 8•1 year ago
•
|
||
https://treeherder.mozilla.org/logviewer?job_id=374318488&repo=autoland&lineNumber=5110
We seem to have some sort of mutex unlocking problem in the GTK code for the file picker. But this could also be some sort of problem with how tsan and GTK interact. I rather suspect we just have to disable the test in that case.
https://treeherder.mozilla.org/logviewer?job_id=374323849&repo=autoland&lineNumber=23379
Not really sure about this, but this leak seems to be related to stencil maybe?
https://treeherder.mozilla.org/logviewer?job_id=374321347&repo=autoland&lineNumber=6600
Running the test under verify mode exposes an already existing problem. The test failure is unrelated to showPicker.
Assignee | ||
Comment 9•1 year ago
|
||
The leaks in this try push might be caused by the opened file pickers. Apparently wpt actually uses platform native pickers even when testing. Do we have some way of closing or suppressing these pickers in wpt/test-driver?
Comment 10•1 year ago
|
||
It's not fully clear to me how this is expected to interact with WebDriver in general. Usually for webapp testing the WebDriver API is to "send_keys" a path to a file input and have that become the uploaded path for that control. In this case, for standard WebDriver, it seems like we'd need to have some other way to specify how the automation should respond to the file picker? For WebDriver-BiDi one could obviously emit an event and allow a response.
Anyway, there's currently no support for this in WebDriver / testdriver / etc. It seems to me that we probably want to be setting some pref that disables the native control: what are we doing for other test harnesses, or are we not testing this outside wpt?
Assignee | ||
Comment 11•1 year ago
|
||
Other tests override the platform native file picker using SpecialPowers.MockFilePicker
.
Comment 12•1 year ago
|
||
Ah, so that's providing a full mock API. We could add something like that to the TestUtils spec (or to HTML!), but my impression is that this is going to be a thing that developers want and so should end up in WebDriver-BiDi. But that isn't a short term solution.
I'm not sure what the best course of action is in the short term. If it's "just" leaks, we could annotate the leaks as expected in the wpt metadata. If we're not actually managing to test the API correctly, we could also copy the tests into the gecko-specific wpt directory; tests in that directory have access to SpecialPowers
so we could make our copy use the mock API to ensure we're not missing coverage in the short term (of course we may end up with missing coverage if the upstream tests are updated, so this isn't an ideal solution).
Comment 13•1 year ago
|
||
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/efc1760055de Add showPicker() to <input> elements. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/33757 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Comment 16•1 year ago
|
||
bugherder |
Comment 17•1 year ago
•
|
||
Docs work in MDN:content:15591 adds some additional examples which you can see here.
This seems to indicate that of the "normally supported types" in the spec:
- Firefox supports input types: color, date, datetime-local, file
- Firefox does not support types: month, week, time and also does not support datalist or autocomplete options.
Is that correct?
FYI other FF101 docs for this can be tracked in https://github.com/mdn/content/issues/15407#issuecomment-1110308404. Most of the work has been done in https://github.com/mdn/content/pull/15591
Comment 19•1 year ago
|
||
Thanks @Tom. I've added https://github.com/mdn/browser-compat-data/pull/16101 to capture that.
Description
•