a11y(bookmarks): li als role=link mit tabindex und Enter-Delegation, Drag/Delegation unberuehrt
This commit is contained in:
@@ -214,6 +214,9 @@ function createBmEl(bm) {
|
|||||||
li.dataset.bmId = bm.id;
|
li.dataset.bmId = bm.id;
|
||||||
li.dataset.bmUrl = bm.url;
|
li.dataset.bmUrl = bm.url;
|
||||||
li.draggable = true;
|
li.draggable = true;
|
||||||
|
li.setAttribute('role', 'link');
|
||||||
|
li.setAttribute('tabindex', '0');
|
||||||
|
li.setAttribute('aria-label', bm.title);
|
||||||
|
|
||||||
const favicon = document.createElement('div');
|
const favicon = document.createElement('div');
|
||||||
favicon.className = 'bm-favicon-local';
|
favicon.className = 'bm-favicon-local';
|
||||||
@@ -267,6 +270,19 @@ function bindBoardListEvents(list, board) {
|
|||||||
window.open(url, settings.newTab ? '_blank' : '_self', 'noopener,noreferrer');
|
window.open(url, settings.newTab ? '_blank' : '_self', 'noopener,noreferrer');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Tastatur: Enter oeffnet den Bookmark wie ein Klick. Delete-Button bleibt
|
||||||
|
// ein echter <button> und feuert seinen eigenen Klick ueber Space/Enter.
|
||||||
|
list.addEventListener('keydown', e => {
|
||||||
|
if (e.key !== 'Enter' && e.key !== ' ') return;
|
||||||
|
const bmItem = e.target.closest('.bm-item');
|
||||||
|
if (!bmItem || e.target !== bmItem) return; // nur wenn der li selbst fokussiert ist
|
||||||
|
e.preventDefault();
|
||||||
|
const url = bmItem.dataset.bmUrl;
|
||||||
|
if (url) {
|
||||||
|
window.open(url, settings.newTab ? '_blank' : '_self', 'noopener,noreferrer');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- MODALS ----
|
// ---- MODALS ----
|
||||||
|
|||||||
Reference in New Issue
Block a user