When reportValidity() is called on a form, any invalid fields get highlighted, as expected. However, if the form is later reset, whether by calling reset() or by clicking on an input of type "reset", any inputs that e.g. are marked required but are blank after reset will be marked as invalid (in most cases the entire form would be marked invalid since reset typically makes a form mostly/blank). The earlier call the reportValidity permanently changed the state of the form such that even resetting it doesn't clear validation status (even though I don't see anything in the spec about reportValidity being a call that should result in a permanent state change, but instead seems to be described as a one-off event). As far as I can tell, there's no way to clear the validation status of a form after calling reportValidity. This is in contrast to what happens if reportValidity() has not previously been called. If reportValidity() hasn't been called, but a field is marked invalid, resetting the form also clears the validation status for the fields (i.e. e.g. required fields that are blank as result of reset won't be marked invalid (until the user interacts with them again)). I've found that the lack of a way to clear the validation status of a form after calling reportValidity() is problematic e.g. if a form is supposed to get reused, because on re-use it already shows up with blank fields marked as invalid.
Reporter, could you kindly attach a minimal testcase showing the issue to this bug?
attaching HTML file with inline instructions for demonstrating the issue
for whatever it's worth, Edge and Internet Explorer don't have this problem; the issue doesn't apply in Chrome either since it doesn't use a border to highlight the fields
John, since you've been working on reportValidity (bug 1088761), could you take a look?
Sure, I'll take a look. Keep NI for tracking.
I am able to reproduce this issue by using the testcase (attachment 8939383 [details]).
Assignee: nobody → jdai
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #8940998 - Flags: review?(bugs)
Pushed by email@example.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/f7567b2adc03 Fix reset a form can't clear -moz-ui-invalid after calling reportValidity. r=smaug
You need to log in before you can comment on or make changes to this bug.