Skip to content

fix(website): give every visitor a play/pause control on the compare clips - #20969

Open
OrangerXu wants to merge 1 commit into
Comfy-Org:mainfrom
OrangerXu:fix/video-compare-pause-toggle
Open

OrangerXu wants to merge 1 commit into
Comfy-Org:mainfrom
OrangerXu:fix/video-compare-pause-toggle

Conversation

@OrangerXu

Copy link
Copy Markdown

Summary

Follow-up to #20955 (which closed #20957): that fix genuinely handles prefers-reduced-motion, posters, and the mobile crop — but WCAG 2.2.2 needs a pause mechanism for every visitor, not only those whose OS preference is set, and the reduced-motion cohort ends up with no way to play the clips at all (never fetched, no controls). The Frame Generation tab's entire claim is smoothness, which a still frame cannot show (#20968).

This adds a play/pause toggle to VideoCompareSlider:

  • Visible on every viewport, aria-pressed tracks the autoplay intent (reads 'playing' for visitors who never touched it), and its label is composed from the localized before/after labels.
  • Clicking it pauses/plays both clips in sync; it stops pointer propagation so it never drags the divider.
  • For reduced-motion visitors it is the opt-in to playing; for everyone else it is the pause mechanism the criterion requires.

Fixes #20968

Verification

  • Tests: two new cases in VideoCompareSlider.test.ts — the toggle flips aria-pressed and calls pause/play on both clips (spy-verified), and clicking it does not move the divider (aria-valuenow stays 50).
  • oxfmt --check clean; eslint clean.
  • The component's test suite runs on Windows locally (no /icons import in its chain), so all 16 ran here.

…clips

WCAG 2.2.2 (Pause, Stop, Hide) needs a pause mechanism for EVERY
visitor, not only those whose OS asks for reduced motion - the clips
loop indefinitely and nothing on the surface could stop them. The same
toggle gives the reduced-motion cohort its only way to opt in to
playing the comparison, which a still frame cannot show (frame
generation's entire claim is smoothness).

The button's pressed state tracks the autoplay intent, so it reads
'playing' for visitors who never touched it, and clicking it neither
drags the divider nor moves the keyboard focus off it.

Fixes Comfy-Org#20968
@OrangerXu
OrangerXu requested a review from a team October 14, 2026 01:00
@coderabbitai

coderabbitai Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters: 2
  • apps/website/src/components/common/VideoCompareSlider.test.ts is excluded by !apps/website/**
  • apps/website/src/components/common/VideoCompareSlider.vue is excluded by !apps/website/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration
  • Configuration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ed6bf843-dc3f-4895-a72a-42ea36a52923

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

✅ All contributors have signed the CLA. Thank you! This PR is ready to be merged.
Posted by the CLA Assistant Lite bot.

@datadog-official

datadog-official Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Pipelines

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: e52bf8c | Docs | View more details | Give us feedback!

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

⚡ Performance: ⚠️ Performance tests failed — check the CI workflow logs

🔬 E2E Coverage: ⚠️ Coverage collection failed — check the CI workflow logs

🎭 Playwright: ⏳ Running...

🎨 Storybook: ❌ Failed

❌ Storybook failed. Open the workflow run and fix the build before merging.

Details

⏰ Completed at: 11/13/2026, 02:02:07 AM UTC

Links

@OrangerXu

Copy link
Copy Markdown
Author

recheck

@dante01yoon dante01yoon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for following up on the WCAG 2.2.2 gap. The motivation is sound, but this cannot land here as is.

Blocking: apps/website was removed from this repo by #21861 (merged 2026-10-26): comfy.org now builds from Comfy-Org/comfy-website, and the shared slider was moved and rewritten as packages/design-system/src/components/common/VideoCompareSlider.vue in #21240 (different props, usePreferredReducedMotion, no toggle). GitHub reports this PR as dirty. Could you re-file the toggle against the website repo (or against the design-system component, if that is where the website now gets it)? The inline points below still apply to the port.

Unanchored: none.

() => isMounted.value && !prefersReducedMotion()
)

// WCAG 2.2.2 (Pause, Stop, Hide): the clips loop indefinitely, so EVERY

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: The repo bans new code comments (AGENTS.md, Common Pitfalls). This block and the one at line 55 hold rationale and an issue link that belong in the PR description. Could they be removed? A name like isPlaying already says what the state is.

<button
type="button"
data-testid="video-compare-toggle"
:aria-pressed="String(!isPlaying)"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: The button flips both its label and aria-pressed, which makes the announced state contradictory. While playing it reads "Pause … comparison, toggle button, not pressed"; after a click it reads "Play … comparison, toggle button, pressed", which sounds like playback is on while the clips are paused. The ARIA APG toggle-button pattern keeps the label fixed when aria-pressed is used. Could we keep one of the two: a fixed "Pause …" label with aria-pressed, or the changing label with no aria-pressed? The test at line 183 would then assert on the accessible name or the pressed state, not both.

type="button"
data-testid="video-compare-toggle"
:aria-pressed="String(!isPlaying)"
:aria-label="

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Pause ${beforeLabel} and ${afterLabel} comparison hard-codes English around the localized labels, so a zh-CN visitor hears a mixed-language name. Could the template go through the site's translation table with placeholders for the two labels, like the other user-facing strings?

const after = afterVideo.value
isPlaying.value = !isPlaying.value
if (isPlaying.value) {
void before?.play().catch(() => undefined)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: isPlaying is set to true before play() settles, and the rejection is dropped. If a browser rejects play() (power saver, data saver), the button shows Pause while nothing plays. Could isPlaying follow the media elements' play/pause events instead, so the button reflects what the clips are actually doing? That would also remove the watch on shouldAutoplay.

})

it('exposes a play/pause toggle that controls both clips (WCAG 2.2.2)', async () => {
// Regression test for #20968: the criterion needs a pause mechanism for

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Same comment rule applies to tests: the regression note belongs in the it title or nowhere, and the line 182 comment repeats the assertion below it. Could both be removed?

This branch was previously deployed

1 inactive deployment
website-approval — e52bf8cf Deployed Oct 14, 2026 by OrangerXu via fast-lane #1913
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants