<?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>30523</bug_id>
          
          <creation_ts>2009-10-19 11:18:48 -0700</creation_ts>
          <short_desc>Add support for :focus-visible CSS pseudo class</short_desc>
          <delta_ts>2024-09-24 16:13:58 -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>CSS</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>185859</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>26856</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Erik Arvidsson">arv</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>709922234</cc>
    
    <cc>adele</cc>
    
    <cc>dvpdiner2</cc>
    
    <cc>gsnedders</cc>
    
    <cc>hyatt</cc>
    
    <cc>jerome</cc>
    
    <cc>john_riviello</cc>
    
    <cc>justus.romijn</cc>
    
    <cc>kyle.bavender</cc>
    
    <cc>mehmet.sahin</cc>
    
    <cc>mitz</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>vertigoback</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>155792</commentid>
    <comment_count>0</comment_count>
    <who name="Erik Arvidsson">arv</who>
    <bug_when>2009-10-19 11:18:48 -0700</bug_when>
    <thetext>For background see

http://enndeakin.wordpress.com/2009/10/05/visible-focus-rings/
https://bugzilla.mozilla.org/show_bug.cgi?id=418521

To sum it up we need a way to differentiate how an element was focused. The focusring pseudo class should be the platform specific pseudo class that we use to show the focus outline.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1253603</commentid>
    <comment_count>1</comment_count>
    <who name="Darryl Pogue">dvpdiner2</who>
    <bug_when>2016-11-24 10:19:52 -0800</bug_when>
    <thetext>This has been added to the CSS Selectors draft as the :focusring pseudoclass
https://github.com/w3c/csswg-drafts/pull/709</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1450556</commentid>
    <comment_count>2</comment_count>
    <who name="Albert Scheiner">vertigoback</who>
    <bug_when>2018-08-15 19:04:47 -0700</bug_when>
    <thetext>The name of the pseudoclass has changed in the meantime to :focus-visible.

Sources:
https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo
https://caniuse.com/#feat=css-focus-visible
https://bugzilla.mozilla.org/show_bug.cgi?id=1445482</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1709903</commentid>
    <comment_count>3</comment_count>
    <who name="Kyle Bavender">kyle.bavender</who>
    <bug_when>2020-11-23 09:11:46 -0800</bug_when>
    <thetext>:focus-visible was added to Chrome 86. Blog post: https://blog.chromium.org/2020/09/giving-users-and-developers-more.html 

I checked in on this as I am building a menu where it would be desirable to remove focus outline styles on an element, but allow for focus outline styles to persist in a condition matching that of :focus-visible.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1724698</commentid>
    <comment_count>4</comment_count>
    <who name="Kyle Bavender">kyle.bavender</who>
    <bug_when>2021-02-02 09:38:15 -0800</bug_when>
    <thetext>:focus-visible was added in the recently-release Firefox 85. Blog post: https://hacks.mozilla.org/2021/01/january-brings-us-firefox-85/ 

With both Chrome and Firefox supporting this feature, I am hopeful that this can be implemented in to WebKit as well.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1728041</commentid>
    <comment_count>5</comment_count>
    <who name="Justus Romijn">justus.romijn</who>
    <bug_when>2021-02-11 05:11:53 -0800</bug_when>
    <thetext>:focus-visible works as expected on Safari 14.0.3, just make sure to have the accessibility settings setup.

For Mac, select &quot;Preferences -&gt; Advanced&quot;, and enable checkmark for:

 [V] : Press Tab to highlight each item on a web page

By default, this is disabled. If you tab through a page in safari, by default it will skip buttons, but it will go to input fields. With this option enabled, it will also go through buttons and other tabbable items.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1728075</commentid>
    <comment_count>6</comment_count>
    <who name="Kyle Bavender">kyle.bavender</who>
    <bug_when>2021-02-11 07:11:56 -0800</bug_when>
    <thetext>re: Justus:
&quot;:focus-visible works as expected on Safari 14.0.3, just make sure to have the accessibility settings setup.&quot;

You are referring to the :focus pseudo-class, not the :focus-visible pseudo-class. You may review documentation for what :focus-visible is and does on this page: https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible . As is said there, :focus-visible &quot;...is useful to provide a different focus indicator based on the user’s input modality (mouse vs. keyboard).&quot; This is in contrast to :focus, which is set on an element whether it was selected via tabbing on the keyboard, or by way of clicking with a mouse.

You can see for yourself that Safari/WebKit do not support the :focus-visible pseudo-class: There is also an Example on the page in which you can test tabbing from one input to button to the next — Safari does not show the dashed dark orange outline that comes from :focus-visible styles as it does in Chrome and Firefox.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1728076</commentid>
    <comment_count>7</comment_count>
    <who name="Justus Romijn">justus.romijn</who>
    <bug_when>2021-02-11 07:19:08 -0800</bug_when>
    <thetext>Indeed I see now I made a mistake. 

The behaviour we were implementing for our UI actually wants default outlines only on focus-visible, but it seems that Safari, with that setting enabled, does that for you (e.g., when tabbing to a button, shows an outline, whilst clicking a button does not) so I wrongly assumed this means the pseudo selector works. But this is by accident just the default behaviour when you opt-in with the accessibility option. Sorry!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1728086</commentid>
    <comment_count>8</comment_count>
    <who name="Kyle Bavender">kyle.bavender</who>
    <bug_when>2021-02-11 07:57:50 -0800</bug_when>
    <thetext>(In reply to Justus Romijn from comment #7)
&gt; Indeed I see now I made a mistake. 
&gt; 
&gt; The behaviour we were implementing for our UI actually wants default
&gt; outlines only on focus-visible, but it seems that Safari, with that setting
&gt; enabled, does that for you (e.g., when tabbing to a button, shows an
&gt; outline, whilst clicking a button does not) so I wrongly assumed this means
&gt; the pseudo selector works. But this is by accident just the default
&gt; behaviour when you opt-in with the accessibility option. Sorry!

Hey no worries! I just wanted to make sure it is clear to all that :focus-visible is unique, and can be very useful. Indeed, earlier this morning I learned via the MDN article linked that the browser does this by default on button elements. This is good to know!

Re: :focus-visible, I am eager for the myriad possibilities that open up both for other types of elements — anchors, input fields, and more — and also for the creation of more helpful and dynamic focus styles that are aware of the input method.

I am a sighted user, but I do try to use my ergonomic keyboard as much as I can (vs. my mouse; both for ergonomics, and for speed), so I am familiar with, and do tend to recommend turning on the macOS setting to allow keyboard navigation to move focus between controls. :focus-visible would be a great tool for making more intuitive and accessible interfaces.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1760705</commentid>
    <comment_count>9</comment_count>
    <who name="Sam Sneddon [:gsnedders]">gsnedders</who>
    <bug_when>2021-05-17 02:55:22 -0700</bug_when>
    <thetext>Forward duping, given that&apos;s where all the discussion/implementation actually is happening.

*** This bug has been marked as a duplicate of bug 185859 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>