MDL-80831 gradereport_grader: Remove unnecessary setting of aria-hidden

- If an element is being hidden visually with `display: none;` (e.g. by
using the class `.d-none`), there's no need to set `aria-hidden` because
it is already hidden from the accessibility tree.
- Setting `aria-hidden=false` is also not recommended and it's better to
remove the `aria-hidden` attribute instead of setting it to false.
This commit is contained in:
Jun Pataleta 2024-03-07 23:00:48 +08:00
parent 89c6376fcc
commit 1085bf7897
No known key found for this signature in database
GPG Key ID: F83510526D99E2C7
3 changed files with 2 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -425,8 +425,6 @@ export default class ColumnSearch extends search_combobox {
const rowCell = avgRowCell ?? rangeRowCell;
rowCell?.classList.toggle('d-none');
rowCell?.setAttribute('aria-hidden',
rowCell?.classList.contains('d-none') ? 'true' : 'false');
} else if (content.classList.contains('d-none')) {
// We should always have content but some cells do not contain menus or other actions.
element.classList.remove('collapsed');
@ -436,19 +434,15 @@ export default class ColumnSearch extends search_combobox {
}
nodeSet.forEach(node => {
node?.classList.remove('d-none');
node?.setAttribute('aria-hidden', 'false');
});
expandButton?.classList.add('d-none');
expandButton?.setAttribute('aria-hidden', 'true');
} else {
element.classList.add('collapsed');
content.classList.remove('d-flex');
nodeSet.forEach(node => {
node?.classList.add('d-none');
node?.setAttribute('aria-hidden', 'true');
});
expandButton?.classList.remove('d-none');
expandButton?.setAttribute('aria-hidden', 'false');
}
}
});