Last Comment Bug 805153 - Drop down selector (combobox) stuck following new selection
: Drop down selector (combobox) stuck following new selection
: regression
Product: Core
Classification: Components
Component: Layout: Form Controls (show other bugs)
: 16 Branch
: All All
-- normal (vote)
: mozilla19
Assigned To: Mats Palmgren (:mats)
: Virgil Dicu [:virgil] [QA]
: Jet Villegas (:jet)
Depends on:
Blocks: CVE-2012-3984
  Show dependency treegraph
Reported: 2012-10-24 13:06 PDT by Olivier
Modified: 2013-01-03 06:45 PST (History)
7 users (show)
ryanvm: in‑testsuite?
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Testcase #1 (464 bytes, text/html)
2012-11-01 11:34 PDT, Mats Palmgren (:mats)
no flags Details
Testcase #2 (457 bytes, text/html)
2012-11-01 11:44 PDT, Mats Palmgren (:mats)
no flags Details
fix (1.93 KB, patch)
2012-11-01 16:36 PDT, Mats Palmgren (:mats)
roc: review+
lukasblakk+bugs: approval‑mozilla‑aurora+
lukasblakk+bugs: approval‑mozilla‑beta+
Details | Diff | Splinter Review

Description User image Olivier 2012-10-24 13:06:07 PDT
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.
Comment 1 User image Loic 2012-10-24 15:28:45 PDT
Could you attach a small html testcase, please. It's more easy to test and debug.
Comment 2 User image Olivier 2012-10-25 01:25:52 PDT
Here is some sample code :
1/ HTML :
  <div class="combotitle">Size</div>
        <select id="Size" name="Size" class="criterion">
        <option value="1">Size 1</option>
        <option value="2">Size 2</option>

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

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

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

if (currentsel == 1)
    return false;

Feel free to play with this on You'll be able to see the issue.
Comment 3 User image Loic 2012-10-31 09:58:31 PDT
Could you post directly the jsfiddle testcase, please.
Comment 4 User image Olivier 2012-10-31 12:21:01 PDT
Here it is :
Comment 5 User image Virgil Dicu [:virgil] [QA] 2012-11-01 08:33:12 PDT

I'll bisect tomorrow if nobody has any idea what caused this.
Comment 6 User image Boris Zbarsky [:bz] (still a bit busy) 2012-11-01 10:32:53 PDT
Likely to be bug 575294 fallout.

Virgil, form control interaction issues are almost certainly not DOM problems, fwiw.
Comment 7 User image Mats Palmgren (:mats) 2012-11-01 11:34:54 PDT
Created attachment 677500 [details]
Testcase #1
Comment 8 User image Mats Palmgren (:mats) 2012-11-01 11:44:15 PDT
Created attachment 677504 [details]
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.
Comment 9 User image Mats Palmgren (:mats) 2012-11-01 15:57:06 PDT
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:
Comment 10 User image Mats Palmgren (:mats) 2012-11-01 16:36:42 PDT
Created attachment 677606 [details] [diff] [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.
Comment 12 User image Ryan VanderMeulen [:RyanVM] 2012-11-02 17:26:21 PDT

Possible to test this?
Comment 13 User image Mats Palmgren (:mats) 2012-11-04 01:11:04 PDT
Comment on attachment 677606 [details] [diff] [review]

[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
Comment 14 User image Lukas Blakk [:lsblakk] use ?needinfo 2012-11-05 12:23:03 PST
Comment on attachment 677606 [details] [diff] [review]

Please land this to branches today so we have it in tomorrow's beta.
Comment 16 User image Virgil Dicu [:virgil] [QA] 2013-01-03 06:45:54 PST
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.

Note You need to log in before you can comment on or make changes to this bug.