Usage Of Alt Attribute For SVG Elements Is Not Allowed #5569 - GitHub
Có thể bạn quan tâm
-
Uh oh!
There was an error while loading. Please reload this page.
- Notifications You must be signed in to change notification settings
- Fork 1.9k
- Star 14.5k
- Code
- Issues 178
- Pull requests 18
- Discussions
- Actions
- Projects 0
- Security
Uh oh!
There was an error while loading. Please reload this page.
- Insights
Description
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
- Go to https://bootstrap-vue.org/docs/icons
- Use "Inspect Element" on one of the icons, selecting the <svg> tag
- 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 assignedLabels
Type
No typeProjects
No projectsMilestone
No milestoneRelationships
None yetDevelopment
No branches or pull requestsIssue actions
You can’t perform that action at this time.Từ khóa » Html Svg Tag Alt Attribute
-
Accessible SVGs | CSS-Tricks
-
Accessibility: Recommended Alt-text Convention For SVG And MathML?
-
Svg-img-alt - Accessibility Insights
-
SVG & Icon Fonts | Accessibility Guidelines
-
Accessible SVG: Methods For Adding Alternative Content - Web Design
-
Is It Possible To Add An 'alt Text' To A Svg File - BigCommerce Support
-
SVG Images And Graphics Require Accessible Text Axe Rules
-
HTML Img Alt Attribute - W3Schools
-
6.2. Managing Alternative Text On SVG (Scalable Vector Graphics)
-
What Should You Use In Place Of Alt Tags For SVG Files For SEO ...
-
How To Add Alt Text To Embedded SVG? - Custom Code - Forum
-
t - Web APIs | MDN
-
Accessible SVGs - University Of Melbourne
-
Decorative Images | Web Accessibility Initiative (WAI) - W3C