Closed Bug 612730 Opened 9 years ago Closed 9 years ago

Make :-moz-ui-valid and :-moz-ui-invalid apply for required select elements

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla2.0b8

People

(Reporter: mounir, Assigned: mounir)

References

Details

Attachments

(3 files, 2 obsolete files)

When bug 596511 will be fixed, :-moz-ui-valid and :-moz-ui-invalid should apply on required select elements.
Summary: Make :-moz-ui-valid and :-moz-ui-invalid apply when for required select elements → Make :-moz-ui-valid and :-moz-ui-invalid apply for required select elements
Assignee: nobody → mounir.lamouri
Status: NEW → ASSIGNED
Attachment #491402 - Flags: review?(bzbarsky)
I will write a part 3. Very likely tomorrow morning.
Attachment #491412 - Flags: review?(bzbarsky)
This is a bit ugly because nsListControlFrame listens to mouse down.
Attachment #491514 - Flags: review?(bzbarsky)
Comment on attachment 491402 [details] [diff] [review]
Part 1 - :-moz-ui-{in,}valid apply if the selected option has been changed

r=me.  I'm starting to really hate aNotify....  We should check whether it can actually be false in this code while the current doc is nonnull.
Attachment #491402 - Flags: review?(bzbarsky) → review+
Comment on attachment 491412 [details] [diff] [review]
Part 2 - :-moz-ui-{in,}valid apply if the user tried to submit the form in an invalid state

r=me
Attachment #491412 - Flags: review?(bzbarsky) → review+
Comment on attachment 491514 [details] [diff] [review]
Part 3 - :-moz-ui-invalid should not apply if the element was valid on focus and :-moz-ui-valid should not apply if no style was applying on focus

I don't think anything guarantees that a left-mouse-down will be followed by a blur.
Attachment #491514 - Flags: review?(bzbarsky) → review-
This is not working correctly for non-combobox select elements but the issue is not important and I really want to have that landed for b8.
If you agree Boris, I will open a follow-up and try to fix the specific issue later (in Firefox 4 time frame I hope).
Attachment #491514 - Attachment is obsolete: true
Attachment #491807 - Flags: review?(bzbarsky)
I spent some time trying to find a theoretical solution to fix that but nothing seems to work:
- we can't select on something else than mousedown ;
- we can't set the bits (mCanShow{Inv,V}alidUI) on mousedown (frame or content) ;
- we can't set mSelectionChanged later (or cache it) ;
- we can't ignore the first selection called by the frame.

So, I would say we should change the expected behavior to match what this patch does or even always update the style as soon as there is an user interaction (for all kind of select or only drop down).
Keywords: dev-doc-needed
That last patch can still get us into a state where mUserInteracting is true when the user is doing nothing of the sort, right?
(In reply to comment #9)
> That last patch can still get us into a state where mUserInteracting is true
> when the user is doing nothing of the sort, right?

Sorry, I pushed the wrong patch. It's the same than the obsoleted one :/
Comment on attachment 492070 [details] [diff] [review]
Part 3 - :-moz-ui-invalid should not apply if the element was valid on focus and :-moz-ui-valid should not apply if no style was applying on focus

>+   * Return if

s/if/whether/

r=me
Attachment #492070 - Flags: review?(bzbarsky) → review+
Attachment #491402 - Flags: approval2.0?
Attachment #491412 - Flags: approval2.0?
Attachment #492070 - Flags: approval2.0?
Whiteboard: [needs approval]
Attachment #491402 - Flags: approval2.0? → approval2.0+
Attachment #491412 - Flags: approval2.0? → approval2.0+
Attachment #492070 - Flags: approval2.0? → approval2.0+
Pushed:
http://hg.mozilla.org/mozilla-central/rev/e077f4fddd25
http://hg.mozilla.org/mozilla-central/rev/8fd7b019a2e6
http://hg.mozilla.org/mozilla-central/rev/f4a67c552e73
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [needs approval]
Target Milestone: --- → mozilla2.0b8
Removing dev-doc-needed, as nothing special needs to be called out in the docs. <select> with required is already among the validated form elements that these pseudo-classes are assumed to apply to.
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.