Skip to content

Commit

Permalink
Accessiblity fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WillYallop committed Apr 4, 2023
1 parent ad90be5 commit fe1b978
Show file tree
Hide file tree
Showing 16 changed files with 19 additions and 24 deletions.
2 changes: 0 additions & 2 deletions apps/playground-fr/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ <h2>Web Components Example - Checkbox Toggler</h2>
>
<label
tabindex="0"
role="button"
for="checkbox-input"
aria-expanded="false"
aria-controls="checkbox-dropdown"
>Toggle</label
>
Expand Down
3 changes: 2 additions & 1 deletion apps/playground-fr/src/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ sticky-header {
}
&.sticky-up {
header {
background-color: blue;
background-color: rgb(7, 7, 92);
color: white;
}
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//# sourceMappingURL=reveal-animation.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//# sourceMappingURL=reveal-animation.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,5 @@ If the attribute is present, the checkbox will be set to checked if the web comp

If the attribute is present, the checkbox will be set to checked if the webcomponent is focused.

## Future Development
## Future Development
- Fix bug with clicking to toggle when focus on is active. Causes it to close after clicking opens and brings focus to it.
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,11 @@ class CheckboxToggler extends HTMLElement {
}
}
private setAttributes() {
this.label?.setAttribute("aria-expanded", "false");
this.label?.setAttribute("tabindex", "0");
this.label?.setAttribute("role", "button");
const targetID = this.getAttribute("data-target-id");
if (targetID) {
this.label?.setAttribute("aria-controls", targetID);
}
if (this.checkbox?.checked) {
this.label?.setAttribute("aria-expanded", "true");
}
}
// Events
private handleClick = (event: MouseEvent) => {
Expand Down Expand Up @@ -110,10 +105,8 @@ class CheckboxToggler extends HTMLElement {
this.checkbox.dispatchEvent(new Event("change"));
const bodyclass = this.getAttribute("body-class");
if (this.checkbox.checked) {
this.label?.setAttribute("aria-expanded", "true");
if (bodyclass) document.body.classList.add(bodyclass);
} else {
this.label?.setAttribute("aria-expanded", "false");
if (bodyclass) document.body.classList.remove(bodyclass);
}
}
Expand Down
Empty file.

0 comments on commit fe1b978

Please sign in to comment.