Skip to content

Commit db3c6e7

Browse files
committed
Slack: Fix positioning of unread messages status for Chrome.
1 parent 1c060bb commit db3c6e7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

SlackA11yFixes.user.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,17 @@ function initial() {
1717
if (elem = document.querySelector("#col_messages"))
1818
elem.setAttribute("aria-owns", "messages_container footer");
1919
// Same for the unread messages status, which appears below in DOM order but earlier visually.
20-
if (elem = document.querySelector("#messages_container"))
21-
elem.setAttribute("aria-owns", "messages_unread_status threads_view_banner monkey_scroll_wrapper_for_msgs_scroller_div monkey_scroll_wrapper_for_threads_msgs_scroller_div");
20+
if (elem = document.querySelector("#messages_container")) {
21+
// We must specify all children so we can guarantee the order.
22+
// The children have different ids in Firefox and Chrome.
23+
var owns = "messages_unread_status";
24+
for (var child of elem.children) {
25+
if (child.id && child.id != "messages_unread_status") {
26+
owns += " " + child.id;
27+
}
28+
}
29+
elem.setAttribute("aria-owns", owns);
30+
}
2231
}
2332

2433
// Make the starred status accessible.

0 commit comments

Comments
 (0)