Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Remove aria-expanded on video toggle

**Release date:** 2026-07-27

## Summary

Following an AnySurfer accessibility audit, the video toggle no longer sets `aria-expanded` on its
trigger. The trigger is hidden or has its label swapped out once the video plays, so it does not
behave as a disclosure control and the expanded/collapsed state was misreported to screen readers.
`aria-controls` on the trigger is unchanged.

## Changed

- `videoToggle.component.ts`: removed the initial `aria-expanded="false"` on the trigger, and the
`aria-expanded` updates in `openVideo()` and `closeVideo()`.
- `videoToggle.component.ts`: Prettier formatting (trailing comma on the iframe `allow`
`setAttribute` call). No behaviour change.

## Docs

You can find the [documentation on our docs](https://statikbe.github.io/craft/frontend/components/videoToggle.html).

# Manual intervention

> ⚠️ **ATTENTION**:
>
> - Run `yarn install && yarn build` in `frontend/` after applying this update so the change lands in
> the compiled bundle.
> - If your project has custom CSS or JS that keys off `[aria-expanded]` on a video toggle trigger
> (for example to swap a play/pause icon), it will no longer match — switch it to a class or to the
> `videotoggle.open` / `videotoggle.close` custom events.
> - If you copied `videoToggle.component.ts` into `js/components-site/`, apply the same removal there
> by hand — that folder is never synced.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"id": "20260727-remove-aria-expanded-on-video-toggle",
"title": "Remove aria-expanded on video toggle",
"description": "Removes the aria-expanded attribute from the video toggle trigger, following an AnySurfer accessibility audit.",
"date": "2026-07-27",
"issues": [573],
"pr": 661,
"requires": [],
"frontend": {
"modify": ["js/components-core/videoToggle.component.ts"]
}
}
15 changes: 14 additions & 1 deletion clint/updates/index.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"schema": 1,
"generatedAt": "2026-06-19T14:44:06.354Z",
"generatedAt": "2026-07-27T14:53:29.273Z",
"updates": [
{
"id": "1.0.1",
Expand Down Expand Up @@ -89,6 +89,19 @@
"requires": [],
"legacyVersion": "1.0.9",
"hasOps": false
},
{
"id": "20260727-remove-aria-expanded-on-video-toggle",
"seq": 9,
"title": "Remove aria-expanded on video toggle",
"date": "2026-07-27",
"issues": [
573
],
"pr": 661,
"requires": [],
"legacyVersion": null,
"hasOps": true
}
]
}
5 changes: 1 addition & 4 deletions frontend/js/components-core/videoToggle.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
}

class VideoToggle {

Check warning on line 31 in frontend/js/components-core/videoToggle.component.ts

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Mark these members as `readonly`.

See more on https://sonarcloud.io/project/issues?id=statikbe_craft&issues=AZ-jg1DTTqPAMtLAU7jL&open=AZ-jg1DTTqPAMtLAU7jL&pullRequest=661
private options = {
url: '',
container: null,
Expand Down Expand Up @@ -99,7 +99,7 @@
this.videoIFrame.setAttribute('title', 'Video embed');
this.videoIFrame.setAttribute(
'allow',
'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture'
'accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture',
);
this.videoIFrame.setAttribute('allowfullscreen', '');
this.videoIFrame.setAttribute('width', '100%');
Expand All @@ -121,7 +121,6 @@
this.options.container.appendChild(this.videoCloseButton);
}

trigger.setAttribute('aria-expanded', 'false');
trigger.setAttribute('aria-controls', 'videoToggleContent' + index);

trigger.addEventListener('click', this.toggleVideo.bind(this));
Expand Down Expand Up @@ -153,7 +152,6 @@

private openVideo(e: Event) {
this.clearVideoContainer();
this.trigger.setAttribute('aria-expanded', 'true');
this.videoContent.classList.remove(this.options.hideClass);

let url = new URL(this.options.url);
Expand Down Expand Up @@ -184,7 +182,6 @@
}

private closeVideo(e: Event) {
this.trigger.setAttribute('aria-expanded', 'false');
this.videoContent.classList.add(this.options.hideClass);
this.videoIFrame.setAttribute('src', '');
if (this.options.showCloseButton) {
Expand Down
Loading