This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 25112 - Since OptGroup is inside a select element. What should happen when OptGroup element is selected. Should the selected option be unselected.
Summary: Since OptGroup is inside a select element. What should happen when OptGroup e...
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-21 08:44 UTC by contributor
Modified: 2014-05-07 21:07 UTC (History)
4 users (show)

See Also:


Attachments

Description contributor 2014-03-21 08:44:05 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-button-element.html
Multipage: http://www.whatwg.org/C#the-optgroup-element
Complete: http://www.whatwg.org/c#the-optgroup-element
Referrer: 

Comment:
Since OptGroup is inside a select element. What should happen when OptGroup
element is selected. Should the selected option be unselected. 

Posted from: 82.43.26.66
User agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Safari/537.36
Comment 1 Habib Virji 2014-03-21 08:56:52 UTC
Bit more background to the issue: 

When OptGroup element is selected
1. IE and Chrome deselects the selected item
2. Firefox selects the first option. 

Issue raised in chrome: https://code.google.com/p/chromium/issues/detail?id=342189.

Optimum solution should be it is a label and no option selected should be changed, neither selectedItem should be changed.
Comment 2 Ian 'Hixie' Hickson 2014-04-01 16:48:24 UTC
What do you mean by "selected" here?
Comment 3 Habib Virji 2014-04-02 09:00:01 UTC
Selected here means an item has been chosen by user using mouse or keyboard. 

In below code snippet:
<select multiple><optgroup label="unselectable label"><option>selectable option</option></optgroup></select>
1. User selects/choose *selectable option* 
2. Then he presses on optGroup label. 
--> Currently clicking on optGroup deselects the selected/chosen item by the user in the chrome and IE.

So query is what the right approach, as spec does not say about it:
1. Keep current items selected as optGroup is just a label, a new behavior currently in no browser. 
2. Get all item unselected and reset selectedIndex as in IE and chrome
3. Deselect the current selection and select the first element as in Firefox
Comment 4 Ian 'Hixie' Hickson 2014-04-07 15:48:00 UTC
It should just be a label, clicking on it should do the same as clicking on the empty space in a four-item-high list box that only has two items, no?

I can try to clarify this...
Comment 5 Habib Virji 2014-04-08 08:16:53 UTC
(In reply to Ian 'Hixie' Hickson from comment #4)
> It should just be a label, clicking on it should do the same as clicking on
> the empty space in a four-item-high list box that only has two items, no?
> 
> I can try to clarify this...

Agreed any clarification will ease things out.
Comment 6 contributor 2014-05-07 21:07:13 UTC
Checked in as WHATWG revision r8611.
Check-in comment: Add some explanatory notes to <optgroup>
http://html5.org/tools/web-apps-tracker?from=8610&to=8611