Richtext features bold and italic render as b and i should render as strong and em
See original GitHub issueBold tag, <b>
, and the italic tag, <i>
, are listed as a WCAG Level A error because most screen readers will NOT announce these changes to the screen reader user.
Ref: https://support.siteimprove.com/hc/en-gb/articles/115002726312-Accessibility-Bold-vs-Strong-and-Italic-vs-Emphasis Ref: https://www.w3.org/TR/WCAG20-TECHS/H49.html
Here is a workaround for anyone bumping into the same issue: https://stackoverflow.com/questions/49902931/wagtail-how-to-override-html-tag-output-from-database-use-strong-or-em-ins#answer-51136618
I think Wagtail should drop b
and i
and use strong
and em
as default.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
lightning-formatted-rich-text - Salesforce Developers
Rich text refers to text that's formatted by HTML tags, such as <strong> for bold text or <u> for underlined text. You can...
Read more >Bold, Italic buttons should produce style, not <strong> and <em> tags
The default action for the Bold and Italic buttons ([B] and [I]) on the toolbar, is to insert the <strong> and <em> tags....
Read more >How to use the @contentful/rich-text-types.MARKS.ITALIC ...
To help you get started, we've selected a few @contentful/rich-text-types.MARKS.ITALIC examples, based on popular ways it is used in public projects.
Read more >Wagtail: How to override HTML tag output from database. Use ...
I got the advice to register a new rich text feature. The documentation shows a strikethrough example. Here are bold (strong) and italic...
Read more >RichText Reference | Block Editor Handbook
RichText is a component that allows developers to render a contenteditable input, providing users with the option to format block content to make...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I will close this now that this is documented via #6090 / #6272: https://docs.wagtail.io/en/latest/advanced_topics/accessibility_considerations.html
Copying the most relevant info here for future reference:
b
orstrong
(tested with the default configuration of NVDA + Firefox, VoiceOver macOS Safari, VoiceOver iOS Safari). See https://github.com/wagtail/wagtail/issues/4665#issuecomment-636050162.We can re-open if someone wants to make the case Wagtail’s default should be changed, but please provide evidence as to why this is a worthwhile change both semantically and pragmatically.
Revisiting this again – I think #4223 will make it possible for people to fix this on their own websites without any change to Wagtail itself, however that still leaves us with the question of what would be the most appropriate default for Wagtail. I did more research.
HTML Specification
For the
i
element,For the
b
element,WCAG
@allcaps already shared the relevant link at the top, https://www.w3.org/TR/WCAG20-TECHS/H49.html. The TL;DR; is “use semantic markup, strong and em”.
Accessibility best practices
Here is the most authoritative information I could find: https://accessibility.psu.edu/boldfacehtml/. It’s really good so I’ll copy the relevant info here. Emphasis mine.
I did my own testing as well and confirmed that screen readers do not announce strong/em/i/b any differently than normal runs of text. Tested with macOS VoiceOver, iOS VoiceOver, ChromeVox, and NVDA. I’d have ideally tested with JAWS as well but didn’t have it available.
Here is my test page if anyone wants to do their own testing: https://condescending-nobel-4e4e3c.netlify.app/
Based on all of this – I would recommend to keep Wagtail’s implementation as-is, and simply document the current state and how to configure this per-site in Wagtail’s rich text documentation once #4223 is merged. While in theory it feels to me like
strong
andem
would be more appropriate, that’s only true if editors do use it in a semantic way (I’m happy to make that assumption) – and regardless, changing this doesn’t actually make a difference to screen reader users. So, there are more important things to worry about.