Files
team/webapp/patches/dom-accessibility-api+0.5.16.patch
5d121c60b8 MM-64868 Update accessible labels and descriptions for various autocompletes (#33553) (#33715)
* Remove the word 'icon' from labels for status icons

* Remove unneeded alt text from at mention suggestion icons

* MM-64868 Update label and description of AtMentionSuggestion

* Update snapshots for other Suggestions

* Remove redundant alt text from EmoticonSuggestion

* Update label and description of ChannelMentionSuggestion

I removed the readout of the channel slug because it's likely redundant,
and I added the icon to it because whether or not the channel is
public/private or archived seems useful to non-sighted users.

* Remove icon from readout of GenericChannelSuggestion

It doesn't depend on anything about the channel, so it's unnecessary.

* Update label and description of GenericUserSuggestion

Same as the AtMentionProvider, the profile image no longer has alt text,
the mention is now the name, and the rest of the text is the
description.

* Update label and description of CommandSuggestion

* Update label and description of SearchChannelWithPermissionsSuggestion

Like ChannelMentionSuggestion, the name is the channel display name and
the description is the type of channel.

* Remove icon from readout of SearchUserSuggestion

* Fix aria-label for ExtensionSuggestion not being read out

* Update label and description of SearchChannelSuggestion

Unlike the ChannelMentionSuggestion, I didn't include the channel type
in this because, as of the previous PR, results are grouped by channel
type.

* Update label and description of SwitchChannelProvider

This one has a lot because of all the different things in that modal,
but I think everything relevant is read out.

* fixup Update label and description of SwitchChannelProvider

* Add some more unit tests

---------


(cherry picked from commit ea15af7fb3)

Co-authored-by: Harrison Healey <[email protected]>
2025-08-14 11:09:17 +03:00

41 lines
3.0 KiB
Diff

diff --git a/node_modules/dom-accessibility-api/dist/accessible-name-and-description.js b/node_modules/dom-accessibility-api/dist/accessible-name-and-description.js
index 585aa65..bb4ec8a 100644
--- a/node_modules/dom-accessibility-api/dist/accessible-name-and-description.js
+++ b/node_modules/dom-accessibility-api/dist/accessible-name-and-description.js
@@ -434,7 +434,14 @@ function computeTextAlternative(root) {
var skipToStep2E = context.recursion && isControl(current) && compute === "name";
if (!skipToStep2E) {
var ariaLabel = ((0, _util.isElement)(current) && current.getAttribute("aria-label") || "").trim();
- if (ariaLabel !== "" && compute === "name") {
+
+ // @hmhealey I commented out the check below for `compute === "name"` because the current version of this library
+ // doesn't allow for one element's description to use another element's aria-label when that other element is in
+ // the first element's aria-describedby. Chrome and Firefox both support that, and based on my reading of
+ // https://www.w3.org/TR/accname-1.2/#computation-steps, step "2.4 AriaLabel" states that that should it should
+ // be supported. This is likely also why the current version of this library fails the
+ // accname/description_from_content_of_describedby_element-manual test from https://github.com/web-platform-tests/wpt.
+ if (ariaLabel !== ""/* && compute === "name"*/) {
consultedNodes.add(current);
return ariaLabel;
}
diff --git a/node_modules/dom-accessibility-api/dist/accessible-name-and-description.mjs b/node_modules/dom-accessibility-api/dist/accessible-name-and-description.mjs
index 8f905f1..aa3f1c5 100644
--- a/node_modules/dom-accessibility-api/dist/accessible-name-and-description.mjs
+++ b/node_modules/dom-accessibility-api/dist/accessible-name-and-description.mjs
@@ -433,7 +433,14 @@ export function computeTextAlternative(root) {
var skipToStep2E = context.recursion && isControl(current) && compute === "name";
if (!skipToStep2E) {
var ariaLabel = (isElement(current) && current.getAttribute("aria-label") || "").trim();
- if (ariaLabel !== "" && compute === "name") {
+
+ // @hmhealey I commented out the check below for `compute === "name"` because the current version of this library
+ // doesn't allow for one element's description to use another element's aria-label when that other element is in
+ // the first element's aria-describedby. Chrome and Firefox both support that, and based on my reading of
+ // https://www.w3.org/TR/accname-1.2/#computation-steps, step "2.4 AriaLabel" states that that should it should
+ // be supported. This is likely also why the current version of this library fails the
+ // accname/description_from_content_of_describedby_element-manual test from https://github.com/web-platform-tests/wpt.
+ if (ariaLabel !== ""/* && compute === "name"*/) {
consultedNodes.add(current);
return ariaLabel;
}