mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Provide more semantic structure for screen-readers
https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA12
This commit is contained in:
parent
e0b1e1002b
commit
13d59bc174
@ -415,7 +415,7 @@ class HTMLTranslator(SphinxTranslator, BaseTranslator):
|
|||||||
# overwritten
|
# overwritten
|
||||||
def visit_title(self, node: Element) -> None:
|
def visit_title(self, node: Element) -> None:
|
||||||
if isinstance(node.parent, addnodes.compact_paragraph) and node.parent.get('toctree'):
|
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.body.append('<span class="caption-text">')
|
||||||
self.context.append('</span></p>\n')
|
self.context.append('</span></p>\n')
|
||||||
else:
|
else:
|
||||||
|
@ -366,7 +366,7 @@ class HTML5Translator(SphinxTranslator, BaseTranslator):
|
|||||||
# overwritten
|
# overwritten
|
||||||
def visit_title(self, node: Element) -> None:
|
def visit_title(self, node: Element) -> None:
|
||||||
if isinstance(node.parent, addnodes.compact_paragraph) and node.parent.get('toctree'):
|
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.body.append('<span class="caption-text">')
|
||||||
self.context.append('</span></p>\n')
|
self.context.append('</span></p>\n')
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user