Provide more semantic structure for screen-readers

https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA12
This commit is contained in:
Joe Nelson 2021-06-17 15:03:34 -05:00
parent e0b1e1002b
commit 13d59bc174
2 changed files with 2 additions and 2 deletions

View File

@ -415,7 +415,7 @@ class HTMLTranslator(SphinxTranslator, BaseTranslator):
# overwritten
def visit_title(self, node: Element) -> None:
if isinstance(node.parent, addnodes.compact_paragraph) and node.parent.get('toctree'):
self.body.append(self.starttag(node, 'p', '', CLASS='caption'))
self.body.append(self.starttag(node, 'p', '', CLASS='caption', ROLE='heading'))
self.body.append('<span class="caption-text">')
self.context.append('</span></p>\n')
else:

View File

@ -366,7 +366,7 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
# overwritten
def visit_title(self, node: Element) -> None:
if isinstance(node.parent, addnodes.compact_paragraph) and node.parent.get('toctree'):
self.body.append(self.starttag(node, 'p', '', CLASS='caption'))
self.body.append(self.starttag(node, 'p', '', CLASS='caption', ROLE='heading'))
self.body.append('<span class="caption-text">')
self.context.append('</span></p>\n')
else: