Bug 201458

Summary: [iOS] Disabled options in the multi-select picker should not be selectable
Product: WebKit Reporter: Ken Petri <kennpetri>
Component: FormsAssignee: Aditya Keerthi <akeerthi>
Status: RESOLVED FIXED    
Severity: Normal CC: akeerthi, cdumez, kris, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: Safari 12   
Hardware: iPhone / iPad   
OS: iOS 12   
Attachments:
Description Flags
Patch
wenson_hsieh: review+
Patch for landing none

Description Ken Petri 2019-09-04 07:19:34 PDT
In iOS on an iPhone it is possible to select a disabled option within the picker if the options contain an optgroup.

For example, an HTML select with the following code will allow the user to select any disabled option within the list of options:

<select>
    <option>one</option>
    <option disabled>two</option>
    <optgroup label="group two">
        <option>three</option>
        <option disabled>four</option>
    </optgroup>
</select>

Options "two" and "four," though marked disabled, can be selected and will appear as chosen within the pop-up button when it collapses.

VoiceOver does not report the disabled options as dimmed (though they style visually as dimmed).

This issue does not affect iPad. Only iPhone's picker manifests the issue.
Comment 1 Radar WebKit Bug Importer 2019-09-04 07:19:48 PDT
<rdar://problem/55018179>
Comment 2 Aditya Keerthi 2020-08-26 12:33:16 PDT
Created attachment 407321 [details]
Patch
Comment 3 Wenson Hsieh 2020-08-26 12:37:19 PDT
Comment on attachment 407321 [details]
Patch

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

> Source/WebKit/UIProcess/ios/forms/WKFormSelectPicker.mm:289
> +        [[view titleLabel] setTextColor:[UIColor colorWithWhite:0.0 alpha:(item.isGroup) ? GroupOptionTextColorAlpha : DisabledOptionAlpha]];

Nit - I think it's a little cleaner without parentheses around item.isGroup here.

> LayoutTests/fast/forms/ios/disabled-options-in-multi-select-picker.html:53
> +    if (!selectElement.multiple) {

Nit - we usually avoid braces around single-line if statements, even in JavaScript.

> LayoutTests/fast/forms/ios/disabled-options-in-multi-select-picker.html:61
> +    for (i = 0; i < element.getElementsByTagName("*").length; i++) {

(Ditto)
Comment 4 Aditya Keerthi 2020-08-26 12:44:56 PDT
Created attachment 407324 [details]
Patch for landing
Comment 5 EWS 2020-08-26 15:03:43 PDT
Committed r266194: <https://trac.webkit.org/changeset/266194>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 407324 [details].
Comment 6 Smoley 2020-12-07 12:04:51 PST
*** Bug 219536 has been marked as a duplicate of this bug. ***