<?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>246591</bug_id>
          
          <creation_ts>2022-10-16 07:24:17 -0700</creation_ts>
          <short_desc>:focus-visible does not work after calling the event.preventDefault() of the keyboard event</short_desc>
          <delta_ts>2024-10-14 07:16:21 -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>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>BrowserCompat, InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>weijarz</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>agafvv</cc>
    
    <cc>cdumez</cc>
    
    <cc>fotis.papadogeorgopoulos</cc>
    
    <cc>karlcow</cc>
    
    <cc>koivisto</cc>
    
    <cc>ntim</cc>
    
    <cc>rego</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1905962</commentid>
    <comment_count>0</comment_count>
    <who name="">weijarz</who>
    <bug_when>2022-10-16 07:24:17 -0700</bug_when>
    <thetext>OS: ArchLinux/GNOME
Webkit: Lastest version

To reproduce:
1. Open below html page.
2. Click `elB` using mouse, now `elB` text color is blue and no blue border.
3. Press key &apos;a&apos;, now `elA` text color is blue and have a blue border.
4. Press key &apos;b&apos;, now `elB` text color is blue, BUT it&apos;s `:focus-visible` css rule (blue border) does not work.

It is displayed correctly in Firefox and Chrome, except for Webkit.


Html page source:
```
&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no&quot;&gt;

&lt;style&gt;
#elA, #elB { margin: 1rem; height: 100px; border: 2px solid #ccc; font-size: 5rem; }
#elA:focus,
#elB:focus { color: blue; }
#elA:focus-visible,
#elB:focus-visible { outline: 2px solid blue; }
&lt;/style&gt;

&lt;div id=&quot;elA&quot; tabindex=&quot;0&quot;&gt;elA&lt;/div&gt;
&lt;div id=&quot;elB&quot; tabindex=&quot;0&quot;&gt;elB&lt;/div&gt;

&lt;script&gt;
document.addEventListener(&apos;keydown&apos;, ev =&gt; {
  if (ev.key === &apos;a&apos;) {
    elA.focus()
  } else if (ev.key === &apos;b&apos;) {
    ev.preventDefault()
    elB.focus()
  }
})
&lt;/script&gt;

```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1907263</commentid>
    <comment_count>1</comment_count>
    <who name="Karl Dubost">karlcow</who>
    <bug_when>2022-10-21 02:04:23 -0700</bug_when>
    <thetext>I have different behaviors on 
Safari Technology Preview  16.4 (156)    18615.1.8.5
Firefox Nightly            108.0a1       10822.10.18
Google Chrome Canary       109.0.5372.0  5372.0
with trackpad.


Safari
2. OK
3. a -&gt; elB is blue and blue border
4. b -&gt; doesn&apos;t change anything visually

Chrome
2. OK
3. a -&gt; elB is blue and blue border
4. b -&gt; doesn&apos;t change anything visually

Firefox
2. OK
3. a -&gt; elB stays blue. doesn&apos;t change anything visually
4. b -&gt; doesn&apos;t change anything visually

so if the steps to reproduce are the ones provided. Safari and Chrome behave the same for me and Firefox is different.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1907650</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-10-23 07:25:17 -0700</bug_when>
    <thetext>&lt;rdar://problem/101474264&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1912173</commentid>
    <comment_count>3</comment_count>
    <who name="">weijarz</who>
    <bug_when>2022-11-13 21:05:07 -0800</bug_when>
    <thetext>(In reply to Karl Dubost from comment #1)
&gt; I have different behaviors on 
&gt; Safari Technology Preview  16.4 (156)    18615.1.8.5
&gt; Firefox Nightly            108.0a1       10822.10.18
&gt; Google Chrome Canary       109.0.5372.0  5372.0
&gt; with trackpad.
&gt; 
&gt; 
&gt; Safari
&gt; 2. OK
&gt; 3. a -&gt; elB is blue and blue border
&gt; 4. b -&gt; doesn&apos;t change anything visually
&gt; 
&gt; Chrome
&gt; 2. OK
&gt; 3. a -&gt; elB is blue and blue border
&gt; 4. b -&gt; doesn&apos;t change anything visually
&gt; 
&gt; Firefox
&gt; 2. OK
&gt; 3. a -&gt; elB stays blue. doesn&apos;t change anything visually
&gt; 4. b -&gt; doesn&apos;t change anything visually
&gt; 
&gt; so if the steps to reproduce are the ones provided. Safari and Chrome behave
&gt; the same for me and Firefox is different.

My test results:

GNOME 43 Default Browser (epiphany, webkit2gtk-4.1):  Does not work
Firefox 106: Perfect
Chromium 107: Perfect</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>