Bug 249627

Summary: option and optgroup shouldn't be focusable if they are hidden or in a menulist
Product: WebKit Reporter: Ahmad Saleem <ahmad.saleem792>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: akeerthi, cdumez, karlcow, rniwa, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   

Description Ahmad Saleem 2022-12-19 18:02:30 PST
Hi Team,

While going through Blink's commit, I came across few more test cases failure:

Test Case - https://jsfiddle.net/n80ompfr/show

^ Safari 16.2 and STP160 both fail a single test case while Chrome Canary 111 and Firefox Nightly 110 passes all.

Test Case - 2 - https://jsfiddle.net/grwehdk6/show

^ Safari 16.2 and STP160 both fail two test cases while Chrome Canary 111 and Firefox Nightly 110 passes all.

Blink Commit - https://chromium.googlesource.com/chromium/blink/+/db4eb7807f1591c3beebe2e40a3c57d9e57a3c85

Just wanted to raise this bug so we can track this. Might try to do PR later.

Thanks!
Comment 1 Ryosuke Niwa 2022-12-19 19:29:13 PST
Seems sensible to merge this.
Comment 2 Radar WebKit Bug Importer 2022-12-26 18:03:15 PST
<rdar://problem/103717395>
Comment 3 Ahmad Saleem 2023-05-30 13:36:33 PDT
Just need to add:

RefPtr select = ownerSelectElement();
    if (select && select->usesMenuList())
        return false;
    return HTMLElement::isFocusable();

in HTMLOptionElement::isFocusable() and HTMLOptGroupElement::isFocusable(), no need to introduce new functions like Blink patch.

Just fixed it locally, will do PR shortly.
Comment 4 Ahmad Saleem 2023-05-30 13:55:39 PDT
Fingers Crossed - https://github.com/WebKit/WebKit/pull/14507
Comment 5 EWS 2023-05-31 14:40:15 PDT
Committed 264755@main (b9e0d14b62e6): <https://commits.webkit.org/264755@main>

Reviewed commits have been landed. Closing PR #14507 and removing active labels.