File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -33,12 +33,27 @@ function setStarred(elem) {
3333 elem . classList . contains ( "starred" ) ? "true" : "false" ) ;
3434}
3535
36+ function message ( text ) {
37+ var live = document . getElementById ( "aria_live_announcer" ) ;
38+ live . textContent = text ;
39+ }
40+
3641function onNodeAdded ( target ) {
3742 if ( target . matches ( ".offscreen[contenteditable]" ) ) {
3843 // Hidden contentEditable near the bottom which doesn't seem to be relevant to the user.
3944 target . setAttribute ( "role" , "presentation" ) ;
4045 return ;
4146 }
47+ // Report incoming messages.
48+ if ( target . matches ( "#msgs_div .message" ) && ! target . classList . contains ( "unprocessed" ) ) {
49+ // Just shove text into a live region that's already used for stuff like this.
50+ // It'd better/less hacky if the messages area itself were a live region,
51+ // but doing this results in double/triple speaking for some reason.
52+ // We also don't want the time reported in this case.
53+ sender = target . querySelector ( ".message_sender" ) . textContent ;
54+ body = target . querySelector ( ".message_body" ) . textContent ;
55+ message ( sender + " " + body ) ;
56+ }
4257 var elem ;
4358 for ( elem of target . querySelectorAll ( ".copy_only" ) ) {
4459 // This includes text such as the brackets around message times.
Original file line number Diff line number Diff line change @@ -69,4 +69,5 @@ It does the following:
6969- Makes star controls (and their statuses) accessible.
7070- Makes the close link for the about channel pane accessible.
7171- Makes day separators in the message history and the about channel pane heading accessible as headings.
72+ - Reports incoming messages automatically (using a live region).
7273- Hides an editable area which isn't shown visually.
You can’t perform that action at this time.
0 commit comments