代码之家  ›  专栏  ›  技术社区  ›  dimitry_n

Safari VoiceOver SVG将`<SVG/>`中的标记作为单独的图像发布

  •  0
  • dimitry_n  · 技术社区  · 4 年前

    我有一个 <svg />

    <svg aria-labelledby="imageLabel-10" class="foo" viewBox="0 -60 577 586">
       <title id="sometitle-10"></title>
       <defs>
          <polygon id="someid" points="1 2 3">
          </polygon>
          <path d="M.123" id="someOtherId">
          </path>
          <mask fill="white" id="oneMoreId">
             <use xlink:href="#someHred">
             </use>
          </mask>
       </defs>
       <g fill="none" fill-rule="evenodd">
          <g style="transform: translateY(-22.0061px); transform-origin: 396.328px 301.186px;">
             <path d="M225" fill="#F75647" fill-rule="nonzero" transform="translate(0, 0)">
             </path>
          </g>
          <g mask="url(#someHref)">
             <image height="461" transform="scale(1.1)" width="693" x="60" xlink:href="//cuteCDNPath.jpg" y="-10" style="transform: scale(1.05339); transform-origin: 286.5px 220.5px;">
             </image>
             <use fill="#000" fill-opacity="0.01" xlink:href="#someOtherHref" style="mix-blend-mode: multiply;">
             </use>
          </g>
       </g>
    </svg>
    

    马科斯莫哈韦10.14.6 Safari 13.0.5版

    0 回复  |  直到 4 年前
        1
  •  1
  •   dimitry_n    4 年前

    According to Deque <svg> 标签需要 role 要设置为的属性 img role="img" 解决了我的问题。

        <svg 
          aria-labelledby="imageLabel-10"
          class="..."
          role="img" <!-- this was the missing attribute -->
          viewBox="..."
        >
        ...
        </svg>