1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2026-01-03 23:42:28 +03:00

Improved accessibility for many editor page components

Related to #1320
This commit is contained in:
Dan Brown
2019-08-26 12:47:04 +01:00
parent 7cc17934a8
commit 64abe10dc4
8 changed files with 38 additions and 24 deletions

View File

@@ -118,8 +118,8 @@ class DropDown {
}
});
// Arrow navigation
this.container.addEventListener('keydown', event => {
// Keyboard navigation
const keyboardNavigation = event => {
if (event.key === 'ArrowDown' || event.key === 'ArrowRight') {
this.focusNext();
event.preventDefault();
@@ -128,9 +128,14 @@ class DropDown {
event.preventDefault();
} else if (event.key === 'Escape') {
this.hide();
this.toggle.focus();
event.stopPropagation();
}
});
};
this.container.addEventListener('keydown', keyboardNavigation);
if (this.moveMenu) {
this.menu.addEventListener('keydown', keyboardNavigation);
}
// Hide menu on enter press or escape
this.menu.addEventListener('keydown ', event => {

View File

@@ -23,6 +23,8 @@ class EditorToolbox {
toggle() {
this.elem.classList.toggle('open');
const expanded = this.elem.classList.contains('open') ? 'true' : 'false';
this.toggleButton.setAttribute('aria-expanded', expanded);
}
setActiveTab(tabName, openToolbox = false) {

View File

@@ -2,8 +2,8 @@ import DropZone from "dropzone";
import { fadeOut } from "../../services/animations";
const template = `
<div class="dropzone-container">
<div class="dz-message">{{placeholder}}</div>
<div class="dropzone-container text-center">
<button type="button" class="dz-message">{{placeholder}}</button>
</div>
`;