Skip to content

Add tabIndex reflection and the Focusable mixin - #120

Merged
cowboyd merged 1 commit into
mainfrom
dom-tabindex
Dec 5, 2026
Merged

cowboyd merged 1 commit into
mainfrom
dom-tabindex

Conversation

@cowboyd

@cowboyd cowboyd commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Reflects tabIndex and gives buttons their default focusability through a shared Focusable mixin, backed by mixin() and createMixin().

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 Dec 1, 2026 •

Copy link
Copy Markdown

commit: 5ec1389

@cowboyd
cowboyd added this pull request to stack #114 December 1, 2026 18:03
@cowboyd
cowboyd marked this pull request as ready for review December 1, 2026 19:16
@cowboyd
cowboyd force-pushed the dom-tabindex branch 2 times, most recently from 49b619a to fe9bc98 Compare December 2, 2026 17:26
@cowboyd
cowboyd marked this pull request as draft December 2, 2026 22:22
@cowboyd cowboyd added the input focus, keyboard, editing, mouse, anything coming from the release. label Dec 2, 2026
@cowboyd cowboyd added this to the Alpha-1 milestone Dec 2, 2026
@cowboyd
cowboyd removed this pull request from stack #114 December 2, 2026 22:23
@cowboyd
cowboyd changed the base branch from dom-inert to main December 3, 2026 19:05
@cowboyd
cowboyd force-pushed the dom-tabindex branch 2 times, most recently from d7ee88f to 3fe27ee Compare December 3, 2026 19:59
@cowboyd
cowboyd marked this pull request as ready for review December 3, 2026 20:00

@natemoo-re natemoo-re left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice! The mixin pattern is lovely 🫶

Comment thread packages/ui/src/mixin.ts
@@ -0,0 +1,51 @@
/* oxlint-disable bombshell-dev/exported-function-async -- Mixin factories return classes synchronously. */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

At this point, we can probably move everything standard-shaped under a src/dom/* directory and turn this rule off in the config.

Comment thread packages/ui/src/parse-tab-index.ts Outdated
export function parseTabIndex(attribute: string | null): number | null {
const match = attribute?.match(/^[\t\n\f\r ]*([+-]?[0-9]+)/);
const value = match ? Number(match[1]) : NaN;
return value >= -2147483648 && value <= 2147483647 ? value || 0 : null;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we extract 2147483648 to a named const to avoid the magic number?

@natemoo-re natemoo-re mentioned this pull request Dec 5, 2026
6 of 12 tasks
@cowboyd
cowboyd merged commit 32c2bb5 into main Dec 5, 2026
9 checks passed
@cowboyd
cowboyd deleted the dom-tabindex branch December 5, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

input focus, keyboard, editing, mouse, anything coming from the release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants