8000 Usage of `alt` attribute for SVG elements is not allowed · Issue #5569 · bootstrap-vue/bootstrap-vue · GitHub
[go: up one dir, main page]

Skip to content 8000
Usage of alt attribute for SVG elements is not allowed #5569
Closed
@RillingDev

Description

@RillingDev

Describe the bug

According to the spec. the alt attribute is not allowed for <svg> elements:
https://www.w3.org/TR/html52/semantics-embedded-content.html#the-img-element
https://www.w3.org/TR/SVG2/struct.html#elementdef-svg

According to this stack-overflow answer, the best approach seems to be usage of a mixture of <title>,<desc> and the aria-label attribute.

Steps to reproduce the bug

  1. Go to https://bootstrap-vue.org/docs/icons
  2. Use "Inspect Element" on one of the icons, selecting the <svg> tag
  3. Check if an alt attribute is set

Expected behavior

No alt attribute is set, instead an aria-label attribute is set and optionally the <title> and <desc> are included in the SVG contents.

Versions

Libraries:

  • BootstrapVue: 2.15.0
  • Bootstrap: 4.5.0
  • Vue: 2.6.11

Environment:

  • Device: Desktop PC
  • OS: Arch Linux
  • Browser: Firefox
  • Version: 78

Demo link

Can be reproduced on https://bootstrap-vue.org/docs/icons

Additional context

As additional note, I'd like to ask if it is possible to also use the icon name in the label? by default right now the value of alt is just "icon" which provides very little context to a screen reader user.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0