<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>323851</bug_id>
          
          <creation_ts>2026-09-10 00:07:55 -0700</creation_ts>
          <short_desc>[QUIRK] google.com: clicking a provider link in the &quot;Where to watch&quot; panel closes the panel instead of navigating</short_desc>
          <delta_ts>2026-09-10 18:05:07 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>Safari 26</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=18425</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>229895</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Karl Dubost">karlcow</reporter>
          <assigned_to name="Karl Dubost">karlcow</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2248940</commentid>
    <comment_count>0</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2026-09-10 00:07:55 -0700</bug_when>
    <thetext>On a Google search result page for a film, the &quot;Where to watch&quot; card expands into a panel of provider rows. Each row is a plain `&lt;a href&gt;`. In Safari, pressing one closes the panel and nothing navigates. Chrome and Firefox navigate on the first press.

**Steps to reproduce**

1. Search Google for a film with several streaming providers. &quot;soylent green&quot; works. 
2. Click the &quot;Where to watch&quot; header, or the &quot;+N more&quot; chip, to expand the panel.
3. Click any provider row.

Result: the panel collapses and the page stays where it is.

Expected: the browser navigates to the provider, as it does in Chrome and Firefox.

**Root cause**

WebKit does not give focus to a plain link when it is pressed. `HTMLAnchorElement::isMouseFocusable()` returns `HTMLElement::supportsFocus()` for a link, which is false unless the link carries `tabindex` or `contenteditable`.

Google&apos;s panel closes itself when focus leaves it. Its container carries `jsaction=&quot;...;blur:.CLIENT&quot;`, and that handler branches on `relatedTarget`. Measured on the live page:

    mousedown on a provider link      activeElement before: the panel header
                                      activeElement after:  body
    +1 ms   blur and focusout on the header, relatedTarget null
    +3 ms   the reveal class is removed and the panel collapses
    +263 ms mouseup lands on a different element, the panel having shrunk
            the click is therefore retargeted to a common ancestor

The link never receives a click, so nothing navigates. The visible symptom is the panel closing, but the closing is the cause rather than a second effect.

The contrasting case in the same session shows the handler is doing what it was written to do. The &quot;+N more&quot; chip is `role=&quot;button&quot; tabindex=&quot;0&quot;`, so it takes focus, `relatedTarget` stays inside the panel, and the panel stays open. Only the bare links fall out.

Confirmed by adding `tabindex=&quot;0&quot;` to the six provider links in the page: they become mouse focusable and the very next press navigates.

**Why a quirk rather than a behaviour change**

WebKit is not violating the specification. HTML leaves this to the user agent:

&gt; A focusable area is said to be click focusable if the user agent determines that it is click focusable.

https://html.spec.whatwg.org/multipage/interaction.html#focus

The specification only says user agents should treat focusable areas with a non-null tabindex as click focusable, which WebKit already does. So this is a divergence from the other engines, not a defect, and changing WebKit&apos;s default focus-on-press behaviour is a much larger change than this site needs.

**Proposed fix**

A new quirk, `needsExpandablePanelAnchorToBeMouseFocusableQuirk`, narrower than the existing `needsAnchorToBeMouseFocusableQuirk` that covers dictionary.com and thesaurus.com for the same root cause:

    URL scope       anyTopLevelDomain(&quot;google&quot;) and pathIs(&quot;/search&quot;)
    element scope   only anchors with an ancestor carrying data-expc

So only links inside the expandable panel become mouse focusable. Every other link on a Google results page is unaffected, and no other Google property is touched. `anyTopLevelDomain` is needed because the panel is locale-dependent and the reproduction is easiest on a ccTLD.

The element check is affordable because `isMouseFocusable()` runs on mouse press, not during style resolution or painting. The ancestor walk is bounded at 12 levels.

Known weakness, stated up front: `data-expc` is Google&apos;s markup. If they rename it the quirk stops matching and the bug returns silently. The alternative is a domain-wide quirk, which changes focus behaviour for every link on the domain. This patch takes the narrower scope; widening it later is a one-line change.

**Test coverage**

`fast/quirks/active-quirks-by-domain.html` gains three URLs covering the scoping: the results page, a deeper path under /search that must not match, and a ccTLD results page. Six expected files updated, since the quirk is cocoa-only and glib must show no change.

**Console output**

No new logging is needed. `Quirks::logQuirksToConsoleIfNecessary()`, called from `FrameLoader.cpp` on main-frame load, already lists every quirk enabled for the URL. On a Google search page the Web Inspector console will show a warning of the form:

    &lt;url&gt; has active WebKit quirks: MaybeBypassBackForwardCache, NeedsExpandablePanelAnchorToBeMouseFocusableQuirk. Visit https://docs.webkit.org/Infrastructure/Quirks.html for more information.

Note this reports quirks enabled for the URL, not quirks that changed behaviour on a given interaction, which is how every table-driven quirk reports.

**Reproducing the bug after the quirk lands**

The quirk hides the bug, so to see the original behaviour again, turn site-specific quirks off:

    MiniBrowser   Settings menu, uncheck &quot;Enable site-specific quirks&quot;
    Safari        Develop menu, the compatibility setting that disables site-specific hacks

With quirks disabled, steps 1 to 3 above fail exactly as reported. With quirks enabled, the provider link navigates. That difference is the check that this patch is doing what it claims.

For a layout test the equivalent switch is `internals.setTopDocumentURLForQuirks(url)`, which turns `needsSiteSpecificQuirks` on and sets the URL used for matching, plus `internals.activeQuirks()` to read back what is enabled.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2248942</commentid>
    <comment_count>1</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2026-09-10 00:08:53 -0700</bug_when>
    <thetext>&lt;rdar://181740296&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2248988</commentid>
    <comment_count>2</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2026-09-10 02:56:57 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/73658</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2249328</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2026-09-10 18:05:05 -0700</bug_when>
    <thetext>Committed 320889@main (e27850ecf367): &lt;https://commits.webkit.org/320889@main&gt;

Reviewed commits have been landed. Closing PR #73658 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>