<?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>312692</bug_id>
          
          <creation_ts>2026-04-18 16:00:15 -0700</creation_ts>
          <short_desc>Add site-specific quirk to make anchor elements mouse-focusable on thesaurus.com</short_desc>
          <delta_ts>2026-04-20 14:35:19 -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>UI Events</component>
          <version>Safari 26</version>
          <rep_platform>Mac (Apple Silicon)</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=229895</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=22261</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=18425</see_also>
    
    <see_also>https://bugs.webkit.org/show_bug.cgi?id=267449</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Sean Patterson">sean_patterson</reporter>
          <assigned_to name="Abrar Rahman Protyasha">a_protyasha</assigned_to>
          <cc>alexander</cc>
    
    <cc>karlcow</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>webkit</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2201882</commentid>
    <comment_count>0</comment_count>
    <who name="Sean Patterson">sean_patterson</who>
    <bug_when>2026-04-18 16:00:15 -0700</bug_when>
    <thetext>rdar://174959285

WebKit ignores preventDefault() on mousedown events when determining whether to change focus. The HTML spec defines mousedown&apos;s default action as including the &quot;focusing steps&quot;, so calling preventDefault() should cancel the focus change.

This is the standard pattern used by virtually every custom autocomplete/dropdown component: calling preventDefault() on mousedown to prevent the input from losing focus (and hiding the dropdown) when clicking a suggestion item. Sites like thesaurus.com rely on this.

Steps to reproduce:
1. Go to https://www.thesaurus.com/
2. Type a word in the search box
3. Click a suggestion in the autocomplete dropdown

Expected: The suggestion is selected and navigates to the result page.
Actual: Nothing happens. The dropdown disappears because the input loses focus (blur fires), removing the suggestion elements from the DOM before the click event reaches them.

Root cause:
In EventHandler::dispatchMouseEvent(), after dispatching the mousedown event, the eventIsDefaultPrevented flag is captured but only used for m_capturesDragging. The focus-change code (lines 3349-3410) runs unconditionally, never checking whether the default was prevented.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2202041</commentid>
    <comment_count>1</comment_count>
    <who name="Sean Patterson">sean_patterson</who>
    <bug_when>2026-04-19 14:10:27 -0700</bug_when>
    <thetext>That&apos;s initial root cause isn&apos;t accurate. It&apos;s not preventDefault(). The real root cause: HTMLAnchorElement::isMouseFocusable() returns false for &lt;a href&gt; links without explicit tabindex on non-GTK platforms.
This is a deliberate Safari behavior (links don&apos;t gain focus on click). But it means:
- Blur&apos;s relatedTarget is null when clicking a link
- Sites relying on relatedTarget in blur handlers (like thesaurus.com) break
- Chromium focuses links on click, so relatedTarget is populated and these sites work</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2202053</commentid>
    <comment_count>2</comment_count>
    <who name="Sean Patterson">sean_patterson</who>
    <bug_when>2026-04-19 16:36:11 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/63082</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2202078</commentid>
    <comment_count>3</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2026-04-19 19:28:11 -0700</bug_when>
    <thetext>Just to note that this is a regular discussion inside the WebKit team. 
And there is a lot of history around it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2202082</commentid>
    <comment_count>4</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2026-04-19 19:37:35 -0700</bug_when>
    <thetext>I don&apos;t know if we will be able to collectively the larger discussion in a reasonable time, but if we want to fix it for thesaurus, we could create a Quirk that would solve it in the meantime for Thesaurus. 
Would that be an acceptable compromise.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2202093</commentid>
    <comment_count>5</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2026-04-19 20:23:38 -0700</bug_when>
    <thetext>* collectively resolve the larger discussion</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2202099</commentid>
    <comment_count>6</comment_count>
    <who name="Alex">alexander</who>
    <bug_when>2026-04-19 20:50:51 -0700</bug_when>
    <thetext>The stubbornness of the webkit team on the subject is unbelievable. The whole wide world works this way, over 80% of global internet population interacts with the web in a way that does focus buttons and links on click and they are absolutely fine. But Apple has to know better than the rest, they are special. And us, the webdevs, suffer jumping through hoops for literally DECADES (how&apos;s that for &quot;reasonable time&quot;?) to get the web to behave reliably.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2202112</commentid>
    <comment_count>7</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2026-04-19 21:34:12 -0700</bug_when>
    <thetext>Alex, This is an *active* discussion these days. 

The WebKit team is trying to find the best path that will make it possible to 

1. Be compatible with the Web
2. Not break the apps that are using the WebKit engine and expect the current behavior
3. Not create Web Compatibility issues for users going to websites with specific codepaths for Safari.
4. Make sure, it fits well with the current accessibility tools on macOS/iOS.

It&apos;s tricky. :/ 
We definitely hear the web developer community and the pain it creates. 
It also leads to have to create Quirks which is far to be ideal too. 


https://searchfox.org/wubkat/rev/bfd8c838d8a13454ce270c5429cd57549ffc98fe/Source/WebCore/page/Quirks.cpp#250-262
```cpp
// ceac.state.gov https://bugs.webkit.org/show_bug.cgi?id=193478
// weather.com rdar://139689157
// madisoncity.k12.al.us https://bugs.webkit.org/show_bug.cgi?id=296989
bool Quirks::needsFormControlToBeMouseFocusable() const
{
#if PLATFORM(MAC)
    QUIRKS_EARLY_RETURN_IF_DISABLED_WITH_VALUE(false);

    return m_quirksData.quirkIsEnabled(QuirksData::SiteSpecificQuirk::NeedsFormControlToBeMouseFocusableQuirk);
#else
    return false;
#endif // PLATFORM(MAC)
}
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2202124</commentid>
    <comment_count>8</comment_count>
    <who name="Alex">alexander</who>
    <bug_when>2026-04-19 22:51:10 -0700</bug_when>
    <thetext>Nothing will break if you just enable focus on click for buttons, checkboxes, links and everything else and not show focus ring, like LITERALLY every other browser. I&apos;m genuinely appalled you guys just add giant if else with hardcoded websites that get a privilege of working properly, absolutely amazing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2202412</commentid>
    <comment_count>9</comment_count>
    <who name="Sean Patterson">sean_patterson</who>
    <bug_when>2026-04-20 14:35:19 -0700</bug_when>
    <thetext>I reverted the original fix and made it a quirk for now.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>