Skip to content

Using SVG the contrast colors are 'unknown' initially #129

@fdverwoerd

Description

@fdverwoerd

So I make lot's of use of svg and symbol usage like so:

<svg class="new-tab-icon">
  <title>{{ "site.new_tab" | translate }}</title>
  <use href="#svg_new_tab"></use>
</svg>

Where use then relates to a symbol defined somewhere else on the page:

<svg height="0" width="0" style="position: absolute;" xmlns="http://www.w3.org/2000/svg">
    <symbol id="svg_new_tab" viewBox="0 0 24 24" fill="currentColor">
      <path d="M0 0h24v24H0z" fill="none"/><path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"/>
    </symbol>
    <symbol id="svg_open_details" viewBox="0 0 25 25"><path d="m20.2 17-7.7-6.4-7.7 6.4-1.3-1.5 9-7.5 9 7.5z"/></symbol>
</svg>

However even if the colors are good for contrast Sa11y can't understand it? After If I click the color input and close the colorpicker it's green :)

Image

Why is it that at the 'start' this is unknown? Can this be fixed?

p.s. I tried embedding the 'whole' svg and not using symbol but still Sa11y initially can't seem to figure out the constrast?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions