Skip to content

Add native keyboard dispatch and WPT input adapters - #126

Open
cowboyd wants to merge 1 commit into
dom-label-focusfrom
ui-keyboard-focus
Open

cowboyd wants to merge 1 commit into
dom-label-focusfrom
ui-keyboard-focus

Conversation

@cowboyd

@cowboyd cowboyd commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

This PR is part of of the "Input Stack" which adds the following capabilities to the DOM

  • Focus management: focus(), blur(), activeElement, focus events, and cleanup when focused nodes are removed.
  • Focus navigation: Tab/Shift+Tab, tabindex ordering, wrapping, and disabled/inert filtering.
  • Focus styling: :focus, :focus-within, and :focus-visible under our keyboard-only policy.
  • Input editing: typing, replacing selections, Backspace/Delete, and cancelable beforeinput followed by input.
  • Caret movement: Left/Right across grapheme boundaries; Up/Down to the beginning/end of single-line inputs.
  • Shift-selection: extend, shrink, and reverse a selection while preserving its anchor. Readonly inputs allow movement and selection.
  • Input state APIs: value, selection endpoints/direction, setSelectionRange(), and setRangeText().

What does this PR do?

This defines the interface by which native events are converted into DOM events. This is what the UI will use when scanning native events from TTY.

As an equivalent, we create a web driver interface for the WPT that will raise those events.

Specifically, adds KeyboardEvent and the minimal set of native events needed to raise those events: createNativeDispatch(document)

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

@cowboyd
cowboyd added this pull request to stack #114 December 1, 2026 18:03
@pkg-pr-new

pkg-pr-new Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

commit: 2a7fa36

@cowboyd
cowboyd force-pushed the ui-keyboard-focus branch 2 times, most recently from 231cfe7 to f8f9cdf Compare December 1, 2026 18:17
@cowboyd
cowboyd marked this pull request as ready for review December 1, 2026 19:53
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