Skip to content

Commit

Permalink
Make marquee visible for screen reader (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuuart authored Aug 26, 2023
1 parent 5e947ba commit ff4c7f5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/kind-carrots-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"manawave": patch
---

Make marquee visible for accessibility customizability
1 change: 0 additions & 1 deletion package/src/dom/components/ticker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import styles from "../styles/ticker.module.css";
export default class TickerComponent extends Component {
constructor() {
const element = document.createElement("div");
element.ariaHidden = "true";
element.classList.add(styles.container);

super(element);
Expand Down
9 changes: 9 additions & 0 deletions package/src/ticker/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ export default class Context {
if (!(selected instanceof WebComponent))
selected.classList.add(styles.manawaveRoot);

// add a11y labeling
selected.role = "marquee";
if (
!selected.ariaLabel &&
!selected.hasAttribute("aria-labelledby")
) {
selected.ariaLabel = "marquee";
}

// WARNING IT HAS TO BE IN THIS SPECIFIC ORDER DO NOT CHANGE
// basically, it first boxes the repeating items to be measured over time
// then it removes them from the dom and places it inside a template to clone from
Expand Down

0 comments on commit ff4c7f5

Please sign in to comment.