Skip to content

Commit c9f01a1

Browse files
committed
Update handling of speech and braille
1 parent 0bb8e90 commit c9f01a1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cjs/util/Util.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ const Util = exports.Util = {
531531
//
532532
if ((!args['include-latex'] && (name == 'data-latex' || name === 'data-latex-item')) ||
533533
(!args.semantics &&
534-
name.match(/^(?:data-semantic-.*|data-speech-node|data-(?:speech|braille)-attached|aria-level)$/))) {
534+
name.match(/^(?:data-semantic-.*|data-speech-node|data-(?:speech|braille)-attached)$/))) {
535535
adaptor.removeAttribute(node, name);
536536
}
537537
}
@@ -557,9 +557,13 @@ const Util = exports.Util = {
557557
if (!args._speech && !args._braille) return;
558558
if (args._speech) {
559559
adaptor.setAttribute(node, 'aria-label', args._speech);
560+
adaptor.setAttribute(node, 'role', 'img');
561+
adaptor.setAttribute(node, 'aria-roledescription', '\u0091'); // not spoken by screen readers
560562
}
561563
if (args._braille) {
562564
adaptor.setAttribute(node, 'aria-braillelabel', args._braille);
565+
adaptor.setAttribute(node, 'role', 'img');
566+
adaptor.setAttribute(node, 'aria-brailleroledescription', 'math');
563567
}
564568
//
565569
// For SVG, find the math node, for CHTML use all children,

mjs/util/Util.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ export const Util = {
530530
//
531531
if ((!args['include-latex'] && (name == 'data-latex' || name === 'data-latex-item')) ||
532532
(!args.semantics &&
533-
name.match(/^(?:data-semantic-.*|data-speech-node|data-(?:speech|braille)-attached|aria-level)$/))) {
533+
name.match(/^(?:data-semantic-.*|data-speech-node|data-(?:speech|braille)-attached)$/))) {
534534
adaptor.removeAttribute(node, name);
535535
}
536536
}
@@ -556,9 +556,13 @@ export const Util = {
556556
if (!args._speech && !args._braille) return;
557557
if (args._speech) {
558558
adaptor.setAttribute(node, 'aria-label', args._speech);
559+
adaptor.setAttribute(node, 'role', 'img');
560+
adaptor.setAttribute(node, 'aria-roledescription', '\u0091'); // not spoken by screen readers
559561
}
560562
if (args._braille) {
561563
adaptor.setAttribute(node, 'aria-braillelabel', args._braille);
564+
adaptor.setAttribute(node, 'role', 'img');
565+
adaptor.setAttribute(node, 'aria-brailleroledescription', 'math');
562566
}
563567
//
564568
// For SVG, find the math node, for CHTML use all children,

0 commit comments

Comments
 (0)