Skip to content

Add focus pseudo-class selectors and Element.matches - #128

Open
cowboyd wants to merge 1 commit into
dom-tab-navigationfrom
dom-focus-selectors
Open

cowboyd wants to merge 1 commit into
dom-tab-navigationfrom
dom-focus-selectors

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?

Adds :focus, :focus-within, and Element.matches(). Under the current keyboard-only policy, :focus-visible matches focused elements.

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 force-pushed the dom-focus-selectors branch from 3fe9ed8 to 96e15fc Compare December 1, 2026 18:08
@pkg-pr-new

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

Copy link
Copy Markdown

commit: bb7ca6e

@cowboyd
cowboyd force-pushed the dom-focus-selectors branch from 96e15fc to e82d541 Compare December 1, 2026 18:17
@cowboyd
cowboyd added this pull request to stack #114 December 1, 2026 18:53
@cowboyd
cowboyd force-pushed the dom-focus-selectors branch from e82d541 to 278a76c Compare December 1, 2026 18:58
@cowboyd
cowboyd force-pushed the dom-focus-selectors branch from 278a76c to bb7ca6e Compare December 1, 2026 19:40
@cowboyd
cowboyd marked this pull request as ready for review December 1, 2026 19:54
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