Autofill of hidden (display: none) forms gives wrong Form#checkValidity until the next tick
Categories
(Core :: DOM: Forms, defect, P2)
Tracking
()
People
(Reporter: mozbugzilla2021, Assigned: masayuki)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:71.0) Gecko/20100101 Firefox/71.0
Steps to reproduce:
- Visit test case at https://jsfiddle.net/snover/yruhfcxg/show
- Click on “Details” to open the
<details>
element - Enter some data into the form fields
- Submit the form
- Choose to save form data in the browser’s autofill, when requested
- Reload the test case so the form data is auto filled
Actual results:
Page output:
Input events fired? 2
Form considered valid? false
Valid on the next tick? true
Expected results:
Page output:
Input events fired? 2
Form considered valid? true
Valid on the next tick? true
Updated•5 years ago
|
Comment 1•5 years ago
|
||
This issue also occurs in Firefox 72 on Windows 10.
Comment 2•5 years ago
|
||
I can reproduce this issue and confirm that if I remove the <details>
wrapper then I get the expected result.
Masayuki, is this a known issue with input.setUserInput(…)
?
Assignee | ||
Comment 3•5 years ago
|
||
(In reply to Matthew N. [:MattN] (PM me if request are blocking you) from comment #2)
I can reproduce this issue and confirm that if I remove the
<details>
wrapper then I get the expected result.Masayuki, is this a known issue with
input.setUserInput(…)
?
I don't know, smaug, do you know?
Comment 4•5 years ago
|
||
I don't know. setUserInput was added for autocomplete/autofill.
https://searchfox.org/mozilla-central/rev/4537228c0a18bc0ebba2eb7f5cbebb6ea9ab211c/dom/html/HTMLInputElement.cpp#2636-2640
looks suspicious, but perhaps this isn't about that.
Comment 5•5 years ago
|
||
Last good revision: 8991d660f20e3eea652e060c30e17670b45a9257 (2018-11-20)
First bad revision: fbd97100c83cc07705244725a3245e6d14bbe9cf (2018-11-21)
Pushlog:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=8991d660f20e3eea652e060c30e17670b45a9257&tochange=fbd97100c83cc07705244725a3245e6d14bbe9cf
I suspect bug 1504911 which caused a similar regression which was already fixed
Bug 1584963 - ValidityState reports invalid patternMismatch for an auto-filled valid "pattern"
Updated•5 years ago
|
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
Ah, I see what's going on. HTMLInputElement::OnValueChanged()
needs to be called before dispatching input
event. It's called only from end of TextControlState::SetValue()
if there is no TextEditor
. That is not late before since HTMLInputElement::SetUserInput()
dispatched input
event later. However, currently, TextControlState::SetValueWithoutTextEditor()
dispatches input
event before that.
Assignee | ||
Comment 7•5 years ago
|
||
I made nsContentUtils::DispatchInputEvent()
update validity of event target
before dispatching eEditorInput
event in bug 1584963. However, this is not
enough because it updates validity only when the type of <input>
element is
mail
, but it's required for other types, for example, <input required>
.
This patch reverts the hack added in bug 1584963, instead, makes
TextControlState::SetValueWithoutTextEditor()
notifies TextControlElement
of value change before dispatching eEditorInput
event because it may have made
damage to the performance if nsContentUtils::DispatchInputEvent()
updated
all validity state of the event target.
Assignee | ||
Comment 9•5 years ago
|
||
Could be uplift to beta, but I don't recommend that for risk management.
Updated•5 years ago
|
Comment 10•5 years ago
|
||
bugherder |
Description
•