Skip to content

Commit 65f7d7c

Browse files
committed
Slack: Several changes:
- Make the headers of search results and the headers of individual threads in All Threads level 3 headings. - Make messages within a search result list items. - Make day separators level 3 headings instead of level 2. - Make the current channel title a level 2 heading. - Remove code to make heading level 2 for about channel pane header, as Slack now does this itself.
1 parent 0939411 commit 65f7d7c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

SlackA11yFixes.user.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function onNodeAdded(target) {
6666
}
6767
var elem;
6868
// Make existing messages list items.
69-
for (elem of target.querySelectorAll("#msgs_div .message, #threads_msgs .message, #convo_container .message"))
69+
for (elem of target.querySelectorAll("#msgs_div .message, #threads_msgs .message, #convo_container .message, #search_results_container .message"))
7070
elem.setAttribute("role", "listitem");
7171
for (elem of target.querySelectorAll(".copy_only")) {
7272
// This includes text such as the brackets around message times.
@@ -79,11 +79,16 @@ function onNodeAdded(target) {
7979
elem.setAttribute("aria-label", "star");
8080
setStarred(elem);
8181
}
82-
// Make headings for day separators in message history, about channel pane heading.
83-
for (elem of target.querySelectorAll(".day_divider,.heading")) {
82+
// Make the current channel title a level 2 heading.
83+
if (elem = target.querySelector("#channel_title")) {
8484
elem.setAttribute("role", "heading");
8585
elem.setAttribute("aria-level", "2");
8686
}
87+
// Make level3 headings for day separators in message history, individual search results, individual threads in All Threads.
88+
for (elem of target.querySelectorAll(".day_divider, .search_result_header, .thread_header")) {
89+
elem.setAttribute("role", "heading");
90+
elem.setAttribute("aria-level", "3");
91+
}
8792
// Kill some extraneous white space.
8893
for (elem of target.querySelectorAll(".message_gutter, .message_content > i.copy_only br")) {
8994
elem.setAttribute("aria-hidden", "true");

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ It does the following:
7676
- Makes options for each message (Start a thread, Share message, etc.) accessible.
7777
To access these, move the mouse to the text of a message.
7878
They then appear above the author's name as buttons.
79-
- Makes day separators in the message history and the about channel pane heading accessible as headings.
79+
- Makes the current channel title, day separators in the message history, the headers of individual search results and the headers of individual threads in All Threads accessible as headings.
8080
- Reports incoming messages automatically (using a live region).
8181
- Hides an editable area which isn't shown visually.
8282

0 commit comments

Comments
 (0)