a11y(toggles): native Checkboxen als role=switch mit synchron gepflegtem aria-checked
This commit is contained in:
@@ -166,6 +166,11 @@ function applySettings() {
|
||||
const imgRefBtn = document.querySelector('[data-action="image-ref"]');
|
||||
if (imgRefBtn) imgRefBtn.classList.toggle('hidden', !settings.imageRefEnabled);
|
||||
|
||||
// A11y: aria-checked aller role=switch-Toggles an den realen checked-State angleichen
|
||||
document.querySelectorAll('.toggle input[role="switch"]').forEach(cb => {
|
||||
cb.setAttribute('aria-checked', cb.checked ? 'true' : 'false');
|
||||
});
|
||||
|
||||
// Toolbar-Position
|
||||
document.body.classList.toggle('toolbar-left', settings.toolbarPos === 'left');
|
||||
const toolbarPosEl = document.getElementById('settingToolbarPos');
|
||||
@@ -250,6 +255,7 @@ function bindSettingsEvents() {
|
||||
const el = document.getElementById(id);
|
||||
if (el) {
|
||||
el.addEventListener('change', async e => {
|
||||
e.target.setAttribute('aria-checked', e.target.checked ? 'true' : 'false');
|
||||
fn(e.target.checked);
|
||||
await saveSettings();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user