Skip to content

Commit

Permalink
fix: enable aria live announcement of name or title on load (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellvix authored Sep 20, 2024
1 parent 14042d7 commit 6553aa8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions galleries/bar_plot.html
Original file line number Diff line number Diff line change
Expand Up @@ -1134,6 +1134,7 @@
id: 'barplot1',
title: 'The Number of Diamonds by Cut.',
selector: 'g[id^="geom_rect"] > rect',
name: 'test test test',
axes: {
x: {
label: 'Cut',
Expand Down
13 changes: 8 additions & 5 deletions src/js/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,14 @@ function InitMaidr(thisMaidr) {
this.SetEvents();

// once everything is set up, announce the chart name (or title as a backup) to the user
if ('name' in singleMaidr) {
display.announceText(singleMaidr.name);
} else if ('title' in singleMaidr) {
display.announceText(singleMaidr.title);
}
setTimeout(function () {
// this is hacky, but we delay just a tick so that the chart has time to load
if ('name' in singleMaidr) {
display.announceText(singleMaidr.name);
} else if ('title' in singleMaidr) {
display.announceText(singleMaidr.title);
}
}, 200);
}
}

Expand Down

0 comments on commit 6553aa8

Please sign in to comment.