commit 999ab6c2bb67964621ef89d27263a83569314daa
parent 3385fc8ab01f1c03dfdba300b07fd49bd093c2b1
Author: Edgar Chen <echen@mozilla.com>
Date: Thu, 6 Nov 2025 15:01:48 +0000
Bug 1998670 - Enable showPicker() support for datalist on early beta only; r=dom-core,farre
Differential Revision: https://phabricator.services.mozilla.com/D271584
Diffstat:
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp
@@ -5949,7 +5949,8 @@ void HTMLInputElement::ShowPicker(ErrorResult& aRv) {
// Step 6 for input elements with a suggestions source element.
// I.e. show the autocomplete dropdown based on the list attribute.
// XXX Form-fill support on android is bug 1535985.
- if (IsSingleLineTextControl(true) && GetList()) {
+ if (StaticPrefs::dom_input_showPicker_datalist_enabled() &&
+ IsSingleLineTextControl(true) && GetList()) {
if (nsCOMPtr<nsIFormFillController> controller =
do_GetService("@mozilla.org/satchel/form-fill-controller;1")) {
controller->SetControlledElement(this);
diff --git a/dom/html/test/forms/test_input_text_show_picker.html b/dom/html/test/forms/test_input_text_show_picker.html
@@ -45,6 +45,10 @@
SimpleTest.waitForExplicitFinish();
window.onload = async function() {
+ await SpecialPowers.pushPrefEnv({
+ set: [["dom.input.showPicker_datalist.enabled", true]],
+ });
+
for (const type of ["text", "search", "email", "url", "tel", "number"]) {
await testWithInputType(type);
}
diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
@@ -3481,6 +3481,12 @@
value: true
mirror: always
+# Whether to enable showPicker() support for datalist.
+- name: dom.input.showPicker_datalist.enabled
+ type: bool
+ value: @IS_EARLY_BETA_OR_EARLIER@
+ mirror: always
+
# Does mousewheel-scrolling over a focused <input type="number"> or
# <input type="range"> field cause the value to increase/decrease (rather
# than scrolling the page)?