Closed Bug 176100 Opened 22 years ago Closed 22 years ago

tabbing out of file upload form control highlights text area contents

Categories

(Core :: Layout: Form Controls, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.3alpha

People

(Reporter: blizzard, Assigned: aaronlev)

References

(Blocks 1 open bug)

Details

(Keywords: access, testcase)

Attachments

(3 files, 3 obsolete files)

Steps to reproduce:

1. Open a bugzilla attachment page
2. Give focus to the file upload form control with the mouse
3. Type something into the file upload form text area
4. Hit tab

Current behaviour:

Contents of the control are selected.

Expected behaviour:

Focus is given to the file selector button.
This must be a regression due to my fix for bug 28583.

Who's forms@layout.bugs? I'll look into this if you want.
Blocks: atfmeta
OS: Linux → All
Hardware: PC → All
There turned out to be a bug in the focus system related to file controls that
caused this.

When you tab to a button, esm::SendFocusBlur() generates a focus event on the
button, which bubbles up to the file control, which gets focused, which turns
around and focuses the textfield!

This causes 2 other problems than the 1 in this bug:
* when tabbing forward through a file control, the button becomes "half"
focused, and the text field becomes half focused.
* when tabbing backward into a file control, it would skip the button and go
straight to the textfield.

Marking sec508, access because of the focus problems.
Assignee: form → aaronl
Blocks: focusnav
Keywords: access, sec508
Priority: -- → P2
Target Milestone: --- → mozilla1.3alpha
This also fixes bug 132557 and bug 141310
Attached file Test case
This shows that tabbing, reverse tabbing, script focus and all work correctly.
You can even click-drag on the "browse" button to focus it.
Comment on attachment 104025 [details] [diff] [review]
When file control gets bubbling focus event, don't focus text field, because it might be bubbling up from the button

+	     formControlFrame->GetType(&formControlType);

Um... how about just checking mType directly and skipping out on the three
virtual calls (to the frame, to the helper, and back to this content node)?

Alternately, you could use "type", which is in scope here and was gotten
above.. but I think that code should die and just check mType too.  ;)
Comment on attachment 104219 [details] [diff] [review]
Uses variable "type" instead of getting it off the form control frame -- duh, thanks

r/sr=bzbarsky if you reinstate that comment saying why the check is needed from
the earlier patch (no need for new patch for that).
Attachment #104219 - Flags: superreview+
Comment on attachment 104219 [details] [diff] [review]
Uses variable "type" instead of getting it off the form control frame -- duh, thanks

r=jkeiser
Attachment #104219 - Flags: review+
Blocks: 1.2
Comment on attachment 104219 [details] [diff] [review]
Uses variable "type" instead of getting it off the form control frame -- duh, thanks

a=roc+moz for trunk
Attachment #104219 - Flags: approval+
checked in
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
The code needs set the focus to the inner text field when the form element
receives a focus event. Now the old code used a hack to prevent it recursively
setting the focus when the text field's focus event bubbled up to the form
element. However the new code explicitly ignores these bubbled events and
therefore the old hack is no longer required.
Great, I just checked this in last night for 1.2 -- you're saying that was
wrong? It seemed to work fine in my tests. Can you explain what my code does wrong?
I see -- you're saying now with the new bubble check I just checked in, we can
get rid of all the BF_SKIP_FOCUS_EVENT stuff.

Bz?
Don't regress bug 17196.... And it's not clear what other problems that's
"fixing".  I would want rods to comment on that....
what am I suppose to comment on?
On whether the "skip focus event" boolean still serves a useful function in
light of the change in this bug....
My patch was just intended to point out the duplication of code.
I'll do more testing to make sure that I don't get any more events.
bz: the difference with my patch is that the onfocus event is generated when
whichever of the inner textfield or button gets focus first; currenty the
onfocus event is only generated when the button gets focus (tabbing forward;
obviously tabbing backward always focuses the button first).
Ah..  That would be a consistency issue worth fixing...
Updated the "Removes the BF_SKIP_FOCUS_EVENT hack" patch for bitrot.
Attachment #104627 - Attachment is obsolete: true
Attachment #107891 - Flags: superreview?(bryner)
Attachment #107891 - Flags: review?(jkeiser)
is this fixed? should the bug be reopened for this last patch? If not then can
you unset the review requests? thanks.
Reopening to fix focus events.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment on attachment 107891 [details] [diff] [review]
Fix focus event when tabbing into file textbox

Yay, goodie.

But one little thing off the bat: you should really decrement the other
#defines if you are removing the 0th one.  Or else put in a comment there
saying // 0 unused - was BF_SKIP_FOCUS_EVENT

So that people will realize that they can use that slot in the future.

r=me otherwise though.
Attachment #107891 - Flags: review?(jkeiser) → review+
Blocks: 173950
Blocks: 185709
Attachment #107891 - Attachment is obsolete: true
Attachment #109526 - Flags: superreview?(bryner)
Attachment #109526 - Flags: review?(jkeiser)
Attachment #107891 - Flags: superreview?(bryner)
No longer blocks: 185709
Attachment #109526 - Flags: review?(jkeiser) → review+
Keywords: testcase
Attachment #109526 - Flags: superreview?(bryner) → superreview+
Fix was checked in by timeless.
Status: REOPENED → RESOLVED
Closed: 22 years ago22 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: