Bug 137991

Summary: [iOS] iPhone should not allow selecting <optgroup> in <select multiple>
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: WebKit2Assignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: dbates, enrica, joepeck, simon.fraser
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
[PATCH] Proposed Fix darin: review+

Description Joseph Pecoraro 2014-10-22 17:33:13 PDT
iPhone should not allow selecting <optgroup> in <select multiple>

* TEST

    <select multiple="multiple">
        <optgroup label="foo">
            <option value="1">0001</option>
            <option value="2">0002</option>
            <option value="3">0003</option>
        </optgroup>
    </select>

* STEPS TO REPRODUCE
1. Load test
2. Tap the "foo" group
  => expected nothing to be selected
  => actual results were "0001" is selected

We should ignore taps on groups.
Comment 1 Joseph Pecoraro 2014-10-22 18:03:11 PDT
<rdar://problem/18745292>
Comment 2 Joseph Pecoraro 2014-10-22 18:14:29 PDT
Created attachment 240316 [details]
[PATCH] Proposed Fix

Patch may not apply as it may be waiting on another change near this.
Comment 3 Darin Adler 2014-10-28 09:17:19 PDT
Comment on attachment 240316 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=240316&action=review

> Source/WebKit2/UIProcess/ios/forms/WKFormSelectPicker.mm:284
> +    // FIXME: <rdar://problem/18745253>
> +    // Group picker content view should not be checkable. If we get this delegate
> +    // reset the styles for the group content view so it still appears unselected.

I don’t think this comment makes it clear enough that this is a workaround for the above bug and can be removed if it’s fixed.

> Source/WebKit2/UIProcess/ios/forms/WKFormSelectPicker.mm:288
> +        [[view titleLabel] setTextColor:[UIColor colorWithWhite:0.0 alpha:0.5]];

Hard-coding this seems really unfortunate and could cause us trouble later. What mitigates that, I suppose, is that we will remove this code when the above mentioned bug is fixed.
Comment 4 Joseph Pecoraro 2014-10-28 11:47:53 PDT
(In reply to comment #3)
> Comment on attachment 240316 [details]
> [PATCH] Proposed Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=240316&action=review
> 
> > Source/WebKit2/UIProcess/ios/forms/WKFormSelectPicker.mm:288
> > +        [[view titleLabel] setTextColor:[UIColor colorWithWhite:0.0 alpha:0.5]];
> 
> Hard-coding this seems really unfortunate and could cause us trouble later.
> What mitigates that, I suppose, is that we will remove this code when the
> above mentioned bug is fixed.

Seeing as we already had a constant for disabled options, I'll add one and share it for groups. This is only duplicating our own styles, not another framework's styles.
Comment 5 Joseph Pecoraro 2014-10-28 12:05:56 PDT
http://trac.webkit.org/changeset/175266