Home

dev / openkara

publicthedavidweng/OpenKara· sync paused
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

test(e2e): wait for dialog initial focus before keyboard steps

merged
#724 opened by devtest/wait-dialog-initial-focus→main
Conversation2 Commits0
devopened this pull requestAuthor· 6 hours ago
Files changed
…

Main CI run 43260797853 (24d9e47) failed in webkit-accessibility: the preferences page nav and source tabs work from the keyboard and a track without audio finds a playable version from the keyboard. The same commit passed on the release PR, so this is a race, not a regression.

Cause: useModalDialog moves focus to the dialog's initial element in a requestAnimationFrame. The tests focused a control inside the dialog right after it opened; when the frame fired later (more often in WebKit), it stole focus back, so ArrowDown/Enter went to the wrong element.

Fix: wait until focus is inside the dialog before moving it, in the three places that did this. Test-only change, no UI change.

Summary of changes

This change affects one file: tests/e2e/accessibility/streaming-sources.spec.ts. It adds 13 lines and removes none. The change is test-only. It does not change UI code.

  • The spec adds a waitForInitialFocus helper. The helper polls until focus is inside the open dialog.
  • After each of three dialogs opens, the test waits for waitForInitialFocus. Only then does the test move focus to the dialog's Import button.

Intended effect: keyboard steps run after the dialog's initial focus is set. This prevents a pending focus move from taking focus away from a control that the test already focused.

No exported or public declarations change.

Verification: the diff was not confirmed in this session. The results of the diff inspection were not returned. The CI status of the two reported failing tests is not available.

coderabbitai[bot]commented· 6 hours ago

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The accessibility E2E tests add a helper that waits for focus to enter a dialog. Three tests use it before continuing keyboard interactions.

Changes: Dialog focus checks

Layer / File(s)Summary
Wait for dialog focus
tests/e2e/accessibility/streaming-sources.spec.ts
A local helper polls until a dialog contains the active element. The preferences, playable-version, and playlist playable-versions tests wait for dialog focus before continuing.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Possibly related PRs

  • thedavidweng/OpenKara#699: Changes dialog focus handling and keyboard navigation tested in the same E2E file.

Suggested labels: javascript

Merge Risk: Minimal · up to cee01

This is a test-only change that makes keyboard-navigation accessibility tests wait for dialog focus before continuing. It has no production impact, and no merge-blocking risk remains.

Pre-merge checks: Passed 8

Check nameStatusExplanation
Description CheckPassedCheck skipped - CodeRabbit’s high-level summary is enabled.
Title checkPassedThe title follows Conventional Commits: it uses the allowed test type with the optional e2e scope and no issue number. It names the main change, which adds a wait for dialog initial focus before k…
Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
Ipc Contract UpdatePassedThe check passes because the diff does not change a public IPC command, payload, event, or source enum. The changed-file inventory for refs/coderabbit/pre-merge-check/base..head lists a single modifie…
No Type EscapesPassedThe PR changes one TypeScript file, tests/e2e/accessibility/streaming-sources.spec.ts. I read the full patch for that file. The added lines are an import type { Locator }, a new helper `waitForIniti…
Acceptance EvidencePassedThe check passes on its first condition: the PR makes no material behavior change. The changed-file inventory shows one file modified, tests/e2e/accessibility/streaming-sources.spec.ts. The patch ad…
Do Not Edit ChangelogPassedThe changed-file inventory for the reviewed range (refs/coderabbit/pre-merge-check/base to head) lists one modified file: tests/e2e/accessibility/streaming-sources.spec.ts. The diff for CHANGELOG.md i…
Full details: Title check

Explanation

The title follows Conventional Commits: it uses the allowed test type with the optional e2e scope and no issue number. It names the main change, which adds a wait for dialog initial focus before keyboard steps in the accessibility E2E test.

Full details: Ipc Contract Update

Explanation

The check passes because the diff does not change a public IPC command, payload, event, or source enum. The changed-file inventory for refs/coderabbit/pre-merge-check/base..head lists a single modified file, tests/e2e/accessibility/streaming-sources.spec.ts (+13/-0). The change adds a Playwright helper, waitForInitialFocus, which polls until the dialog contains document.activeElement. It calls that helper in three places before keyboard steps. This is test-only code. No IPC surface is touched, so no docs/references/contracts/ update is required. The contracts directory exists and was not changed, which is consistent with the check.

Full details: No Type Escapes

Explanation

The PR changes one TypeScript file, tests/e2e/accessibility/streaming-sources.spec.ts. I read the full patch for that file. The added lines are an import type { Locator }, a new helper waitForInitialFocus(dialog: Locator) that polls dialog.evaluate((el) => el.contains(document.activeElement)), and three await waitForInitialFocus(dialog); calls. None of the added lines contains as any, [@ts-ignore](/ts-ignore), or [@ts-expect-error](/ts-expect-error). The helper uses the typed Locator parameter, not any. My follow-up grep failed because of a flag error in my own command, so this verdict rests on the direct diff read.

Full details: Acceptance Evidence

Explanation

The check passes on its first condition: the PR makes no material behavior change. The changed-file inventory shows one file modified, tests/e2e/accessibility/streaming-sources.spec.ts. The patch adds a test-only helper, waitForInitialFocus, which polls until the dialog contains document.activeElement. It calls that helper in three places before keyboard steps. No production code changes, which matches the PR description and the summary. The check's second condition also has supporting evidence. The PR description names the failing CI run (43260797853) and the two failing tests. It also cites the root cause, a requestAnimationFrame focus race in useModalDialog. The PR has no separate acceptance criteria list. The changed test file names the affected tests. Because the check passes on the no-material-change condition, the missing criteria list does not change the result.

Full details: Do Not Edit Changelog

Explanation

The changed-file inventory for the reviewed range (refs/coderabbit/pre-merge-check/base to head) lists one modified file: tests/e2e/accessibility/streaming-sources.spec.ts. The diff for CHANGELOG.md is empty, so CHANGELOG.md is unchanged. The check passes because it only fails when CHANGELOG.md is hand-edited.

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

  • X
  • Mastodon
  • Reddit
  • LinkedIn
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: thedavidweng/OpenKara
  • Branch: test/wait-dialog-initial-focus
  • File: .coderabbit.yaml
  • Commit: cee01ed
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 84f120fc-771f-4bb2-99ab-fcb78acc4338
Commits

Reviewing files that changed from the base of the PR and between 24d9e47642fad5acecb6eba303d4fd4449a49d5d and cee01ed2e78fc80e50dda3f1d9a179511bccedff.

Files selected for processing: 1

  • tests/e2e/accessibility/streaming-sources.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

kilo-code-bot[bot]commented· 6 hours ago

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • tests/e2e/accessibility/streaming-sources.spec.ts

Reviewed by free · Input: 109.4K · Output: 15.3K · Cached: 690.4K

Sign in to comment.

Merge readiness

Checking mergeability after the indexing worker computes the current branch state.

Autopilot

Debug

Reviews

Approved0
ReviewersNone yet

Configure an OpenRouter key in repository settings.