<?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>187799</bug_id>
          
          <creation_ts>2018-07-19 05:28:53 -0700</creation_ts>
          <short_desc>SVG &lt;a&gt; with focus lacks visual indicator</short_desc>
          <delta_ts>2025-01-22 15:02:06 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>SVG</component>
          <version>Safari 11</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <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="Peter Krautzberger">peter</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>ap</cc>
    
    <cc>bfulgham</cc>
    
    <cc>jdiggs</cc>
    
    <cc>j.gerbes</cc>
    
    <cc>rniwa</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zimmermann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1443336</commentid>
    <comment_count>0</comment_count>
    <who name="Peter Krautzberger">peter</who>
    <bug_when>2018-07-19 05:28:53 -0700</bug_when>
    <thetext># Reproduce

* visit https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a
* open the sample there
* focus one of the links

Expected result

The link has some visual indication that it is in focus. 

# Actual result

There is no visible indication that the link is in focus.

# Notes

* Also confirmed on WebKitGTK+  2.20.3
* Defining a CSS outline has no effect
* Chrome, Firefox, and Edge behave as expected
* workaround: wrapping the &lt;a&gt;&apos;s children in a &lt;rect&gt; and specifying stroke-related properties for a:focus&gt;rect works.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1443378</commentid>
    <comment_count>1</comment_count>
    <who name="Peter Krautzberger">peter</who>
    <bug_when>2018-07-19 09:32:07 -0700</bug_when>
    <thetext>As @joanie pointed out, the example on MDN includes some CSS which may be confusing. Those styles do not include anything for focus, but styles for hover and active instead (which are also not working in WebKit but everywhere else).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1886740</commentid>
    <comment_count>2</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-07-26 04:16:50 -0700</bug_when>
    <thetext>I am able to reproduce this bug in Safari 15.6 on macOS 12.5, while going to MDN article and looking into loaded example, if you hover over &lt;circle&gt; anchor link, it does not show outline to highlight that it is link although cursor do change to show that it is link to click, while all in other browsers (Chrome Canary 106 and Firefox Nightly 104) it does. Just wanted to share updated testing results. Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1886975</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2022-07-26 19:49:33 -0700</bug_when>
    <thetext>&lt;rdar://problem/97642031&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1920294</commentid>
    <comment_count>4</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2022-12-17 16:04:39 -0800</bug_when>
    <thetext>We need to update &quot;svg.css&quot; with following to fix this:

/* As SVG does not provide a default visual style for links,
   it&apos;s considered best practice to add some */

@namespace svg url(http://www.w3.org/2000/svg);
/* Necessary to select only SVG &lt;a&gt; elements, and not also HTML&apos;s.
   See warning below */

svg|a:link,
svg|a:visited {
  cursor: pointer;
}

svg|a text,
text svg|a {
  fill: blue; /* Even for text, SVG uses fill over color */
  text-decoration: underline;
}

svg|a:hover,
svg|a:active {
  outline: dotted 1px blue;
}

https://github.com/WebKit/WebKit/blob/c2dd7ba9890874670b16f914a46afb7c420da9ce/Source/WebCore/css/svg.css#L4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2089096</commentid>
    <comment_count>5</comment_count>
    <who name="">j.gerbes</who>
    <bug_when>2025-01-22 15:02:06 -0800</bug_when>
    <thetext>This bug is still present in WebKit 20621.1.9.111.1.

The default `:focus` styles are being applied on focus, but it seems that `outline` is not rendered for `&lt;a&gt;` and `&lt;svg&gt;` elements within an `&lt;svg&gt;` element:

&lt;html&gt;
  &lt;head&gt;
    &lt;style&gt;
      .outline {
        outline: 1px solid red;
      }
    &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;h2&gt;Outline on outer SVG element (rendered)&lt;/h2&gt;
    &lt;svg
      class=&quot;outline&quot;
      viewBox=&quot;0 0 100 100&quot;
      xmlns=&quot;http://www.w3.org/2000/svg&quot;
      width=&quot;100&quot;
      height=&quot;100&quot;
    &gt;
      &lt;circle cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;35&quot; /&gt;
    &lt;/svg&gt;

    &lt;h2&gt;Outline on circle element (rendered)&lt;/h2&gt;
    &lt;svg
      viewBox=&quot;0 0 100 100&quot;
      xmlns=&quot;http://www.w3.org/2000/svg&quot;
      width=&quot;100&quot;
      height=&quot;100&quot;
    &gt;
      &lt;circle class=&quot;outline&quot; cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;35&quot; /&gt;
    &lt;/svg&gt;

    &lt;h2&gt;Outline on anchor element (not rendered)&lt;/h2&gt;
    &lt;svg
      viewBox=&quot;0 0 100 100&quot;
      xmlns=&quot;http://www.w3.org/2000/svg&quot;
      width=&quot;100&quot;
      height=&quot;100&quot;
    &gt;
      &lt;a class=&quot;outline&quot; href=&quot;#&quot;&gt;
        &lt;circle cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;35&quot; /&gt;
      &lt;/a&gt;
    &lt;/svg&gt;

    &lt;h2&gt;Outline on inner SVG element (not rendered)&lt;/h2&gt;
    &lt;svg
      viewBox=&quot;0 0 100 100&quot;
      xmlns=&quot;http://www.w3.org/2000/svg&quot;
      width=&quot;100&quot;
      height=&quot;100&quot;
    &gt;
      &lt;svg class=&quot;outline&quot;&gt;
        &lt;circle cx=&quot;50&quot; cy=&quot;50&quot; r=&quot;35&quot; /&gt;
      &lt;/svg&gt;
    &lt;/svg&gt;
  &lt;/body&gt;
&lt;/html&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>