Skip to content

Add event capture to unlock focus and keyboard navigation tests - #111

Open
cowboyd wants to merge 1 commit into
mainfrom
dom-event-capture
Open

cowboyd wants to merge 1 commit into
mainfrom
dom-event-capture

Conversation

@cowboyd

@cowboyd cowboyd commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Establishes the event-dispatch foundation needed to unlock the focus and keyboard-navigation WPTs. Many of the these tests use capture listeners on ancestors to observe non-bubbling focus and blur events and verify the sequence produced by keyboard navigation, so to not have capture support means that we have to either forego that test coverage, or try to patch the upstream WPT.

However, this does retain the requirement of using the global Event and EventTarget classes so that instanceof checks continue to work globally.

Some of the older WPT fixtures require document.createEvent() and initEvent(), so those have been added as well.

Focus and keyboard-navigation test groups this foundation unlocks

  1. Focus transitions and reentrant handlers: event order, related targets, and handlers that change focus. Examples: uievents/focusevents/blur-relatedTarget.html and focus/focus-sync-when-blur.html.
  2. Focus eligibility, label forwarding, and removal: inert/disabled controls, associated controls, and removal without blur events. Examples: inert/inert-label-focus.html and dom/nodes/insertion-removing-steps/blur-event.window.js.
  3. Keyboard dispatch, modifiers, and canceled default actions: examples include uievents/constructors/event-getmodifierstate.html and uievents/keyboard/keydown-input-events.html.
  4. Tab navigation and tabindex ordering: focus-tabindex-positive.html and focus-tabindex-order.html under html/interaction/focus/sequential-focus-navigation-and-the-tabindex-attribute/. Both directly depend on capture listeners for focus and keyboard events.
  5. Shift+Tab and navigation after mutation: reverse navigation and continued navigation after disabling or removing the focused element. Examples under html/interaction/focus/: tab-table-caption.html, sequential-focus-navigation-after-disabled.html, and sequential-focus-navigation-starting-point.tentative.html.

Type of change

  • Bug fix
  • Feature
  • Refactor (no behavior change)
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • All tests pass (pnpm test)
  • Files are formatted (pnpm format)
  • I have added/updated tests for my changes (if applicable)
  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

@pkg-pr-new

pkg-pr-new Bot commented Nov 30, 2026

Copy link
Copy Markdown

commit: 3c7f5db

@cowboyd
cowboyd marked this pull request as ready for review November 30, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant