Bug 201458 - [iOS] Disabled options in the multi-select picker should not be selectable
Summary: [iOS] Disabled options in the multi-select picker should not be selectable
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: Safari 12
Hardware: iPhone / iPad iOS 12
: P2 Normal
Assignee: Aditya Keerthi
Keywords: InRadar
: 219536 (view as bug list)
Depends on:
Reported: 2019-09-04 07:19 PDT by Ken Petri
Modified: 2020-12-07 12:04 PST (History)
6 users (show)

See Also:

Patch (8.90 KB, patch)
2020-08-26 12:33 PDT, Aditya Keerthi
wenson_hsieh: review+
Details | Formatted Diff | Diff
Patch for landing (8.88 KB, patch)
2020-08-26 12:44 PDT, Aditya Keerthi
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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:

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

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
Comment 2 Aditya Keerthi 2020-08-26 12:33:16 PDT
Created attachment 407321 [details]
Comment 3 Wenson Hsieh 2020-08-26 12:37:19 PDT
Comment on attachment 407321 [details]

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++) {

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. ***