Closed Bug 805153 Opened 12 years ago Closed 12 years ago

Drop down selector (combobox) stuck following new selection

Categories

(Core :: Layout: Form Controls, defect)

16 Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19
Tracking Status
firefox17 --- fixed
firefox18 --- verified

People

(Reporter: autremonde75, Assigned: MatsPalmgren_bugz)

References

Details

(Keywords: regression)

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20100101 Firefox/16.0
Build ID: 20121010144125

Steps to reproduce:

I have a drop down selector with multiple items into it. After selecting a new item with the mouse, when I complete the selection, if I click again on the selector to select another item, it is stuck. I have to click somewhere else on the page to allow the selection to happen again. Otherwise, the drop down selector will just not react to the mouse click.


Actual results:

I saw this problem happening while having events attached to the selection. For instance, selecting item 1 will show a div "A" with some form elements and hide a div "B" with some other form elements. Selecting item 2 will show div "B" with some form elements and hide div "A" with other form elements. It looks like the show/hide of div is somehow the trigger of the drop down lock.

In the Firefox debugging tool, I have the following exception :
[object XPC_WN_ModsAllowed_NoCall_Proto_JSClass]

Not sure if it is related but it is what is reported when the problem happens.

Please note that this issue is only present in Firefox 16. It wasn't there in Firefox 15.


Expected results:

Drop down shouldn't have been stuck after new selection.
Could you attach a small html testcase, please. It's more easy to test and debug.
Here is some sample code :
1/ HTML :
  <div class="combotitle">Size</div>
  <form>
        <select id="Size" name="Size" class="criterion">
        <option value="1">Size 1</option>
        <option value="2">Size 2</option>
        </select>
  </form>

  <div id="combotitle1" style="display:none;">Style
  <form>
        <select id="Style" name="Style" class="criterion">
        <option value="1">Style 1</option>
        <option value="2">Style 2</option>
        </select>
  </form></div>

  <div id="combotitle2" style="display:none;">Color
  <form>
        <select id="Color" name="Color" class="criterion">
        <option value="1">Color 1</option>
        <option value="2">Color 2</option>
        </select>
  </form></div>

2/ Jquery code :
jQuery('#Size').change(function()
{
    var currentsel = jQuery('#Size option:selected').val();

if (currentsel == 1)
{
    jQuery('#combotitle1').css('display','inline');
    jQuery('#combotitle2').css('display','none');
}    
else
{
    jQuery('#combotitle1').css('display','none');
    jQuery('#combotitle2').css('display','inline');
}
    
    return false;
});

Feel free to play with this on http://jsfiddle.net. You'll be able to see the issue.
Could you post directly the jsfiddle testcase, please.
Here it is :
http://jsfiddle.net/Swztb/
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=bb4b37094b9f&tochange=cb2904476d14

I'll bisect tomorrow if nobody has any idea what caused this.
Status: UNCONFIRMED → NEW
Component: Untriaged → DOM
Ever confirmed: true
Keywords: regression
OS: Windows 7 → All
Product: Firefox → Core
Hardware: x86_64 → All
Likely to be bug 575294 fallout.

Virgil, form control interaction issues are almost certainly not DOM problems, fwiw.
Component: DOM → Layout: Form Controls
Summary: Drop down selector stuck following new selection → Drop down selector (combobox) stuck following new selection
Attached file Testcase #1
Assignee: nobody → matspal
Attached file Testcase #2
It seems it only occurs if the 2nd <select> is in a block-in-inline
situation, and it must be a combobox too, not <input> or <select mutliple>
for example.  Weird.
The IB split makes the frame ctor a bit brutal -- it calls RecreateFramesForContent
on the parent, that is <body>, which reframes the first <select> too.
So when nsComboboxControlFrame::ShowDropDown is called (on the second click)
it sees "sFocused != this" so we delay it waiting for an expected SetFocus call.
But FocusManager doesn't call Focus on content if it's already focused:
http://hg.mozilla.org/mozilla-central/annotate/aabf7175cc84/dom/base/nsFocusManager.cpp#l1109
Attached patch fixSplinter Review
It looks like sFocused is some kind of hack for bug 32920; I shouldn't
have used it :(

Check our *content* with the focus manager instead.
Attachment #677606 - Flags: review?(roc)
https://hg.mozilla.org/mozilla-central/rev/0829f3b5c51e

Possible to test this?
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Comment on attachment 677606 [details] [diff] [review]
fix

[Approval Request Comment]
Bug caused by (feature/regressing bug #): 575294
User impact if declined: After script does certain restyle changes on a combobox or its ancestors, clicking the combobox does not open the menu unless you unfocus it and click it again
Testing completed (on m-c, etc.): on m-c since 2012-11-02
Risk to taking this patch (and alternatives if risky): very low risk
String or UUID changes made by this patch: none
Attachment #677606 - Flags: approval-mozilla-beta?
Attachment #677606 - Flags: approval-mozilla-aurora?
Comment on attachment 677606 [details] [diff] [review]
fix

Please land this to branches today so we have it in tomorrow's beta.
Attachment #677606 - Flags: approval-mozilla-beta?
Attachment #677606 - Flags: approval-mozilla-beta+
Attachment #677606 - Flags: approval-mozilla-aurora?
Attachment #677606 - Flags: approval-mozilla-aurora+
Mozilla/5.0 (X11; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0

Verified Windows 8, Ubuntu 12.04 and Mac OS 10.7 with Firefox beta 6. 
Both testcases and jsfiddle work as expected.
QA Contact: virgil.dicu
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: