Remove extraneous aria-labels on theme buttons
This commit is contained in:
parent
f7bc03e8af
commit
03c91b97f2
1 changed files with 5 additions and 2 deletions
|
|
@ -60,8 +60,11 @@ function setPreference() {
|
|||
|
||||
function reflectPreference() {
|
||||
document.firstElementChild.setAttribute('data-theme', theme.value);
|
||||
document.querySelector('#light-theme-toggle')?.setAttribute('aria-label', lightLabel);
|
||||
document.querySelector('#dark-theme-toggle')?.setAttribute('aria-label', darkLabel);
|
||||
// Let the button content set its accessible name. There is no need for an aria-label on a button with visible text.
|
||||
// This practice can become a problem when the page is translated by the browser as often aria-labels are left alone
|
||||
// this code would override the translated language and confuse the user
|
||||
// document.querySelector('#light-theme-toggle')?.setAttribute('aria-label', lightLabel);
|
||||
// document.querySelector('#dark-theme-toggle')?.setAttribute('aria-label', darkLabel);
|
||||
}
|
||||
|
||||
function updateMetaThemeColor() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue