1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-24 02:33:26 +03:00

Added focus and a11y attributes/functionality to custom checkboxes

Closes #1476
This commit is contained in:
Dan Brown
2019-06-04 10:45:44 +01:00
parent a602cdf401
commit a9f983f156
6 changed files with 51 additions and 8 deletions

View File

@@ -6,12 +6,11 @@ class ToggleSwitch {
this.input = elem.querySelector('input[type=hidden]');
this.checkbox = elem.querySelector('input[type=checkbox]');
this.checkbox.addEventListener('change', this.onClick.bind(this));
this.checkbox.addEventListener('change', this.stateChange.bind(this));
}
onClick(event) {
let checked = this.checkbox.checked;
this.input.value = checked ? 'true' : 'false';
stateChange() {
this.input.value = (this.checkbox.checked ? 'true' : 'false');
}
}