Skip to content

Add HTML focusability and disabled reflection - #102

Closed
cowboyd wants to merge 1 commit into
dom-datasetfrom
focusability
Closed

cowboyd wants to merge 1 commit into
dom-datasetfrom
focusability

Conversation

@cowboyd

@cowboyd cowboyd commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Add initial HTML focusability checks to HTMLElement.focus(), using element defaults, tabIndex, link destinations, disabled and inert state, summary placement, and editable content. Register the corresponding HTML element classes in the document factory.

Add boolean disabled reflection on buttons, inputs, selects, textareas, fieldsets, options, and option groups.

Follow-ups remain for disabled-fieldset legend exceptions and descendants, invalid tabindex defaults, summary placement, and empty or case-insensitive contenteditable values. SVG focus support remains deferred.

Type of change

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

Checklist

  • I have added a changeset

AI-generated code disclosure

  • This PR includes AI-generated code

@cowboyd
cowboyd added this pull request to stack #98 November 18, 2026 20:22
@pkg-pr-new

pkg-pr-new Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/bombshell-dev/ui/@clack/ui@102

commit: 1f5e3a1

Comment thread packages/ui/src/dom.ts
}
}

export class DisableableElement extends HTMLElement {

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.

Should we add aria-disabled support now or are we planning on doing a separate accessibility tree pass?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmmm, lemme see how hard it would be to add now....

Comment thread packages/ui/src/dom.ts
}
}

export class DisableableElement extends HTMLElement {

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.

Curious why we're not using a Disablable mixin like Focusable!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's so that we could make an instanceof check in the isFocusable() method. I wanted to make this a mixing, but couldn't quite figure it out.

We could have a hidden Symbol.for('@bomb.sh/ui/disablable') that marks the prototype of the mixin instead?

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.

@cowboyd how about something like this? 8a91634

I'm not totally sure if there are TypeScript performance considerations for this model, but I know lib.dom.d.ts inlines everything. For maintenance, I think the mixins approach is probably good for now

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.

Looks like mixin(HTMLElement, [Disableable, Focusable]) produces this

declare const HTMLButtonElement_base: typeof HTMLElement & Constructor<Disableable> & Constructor<Focusable>;
export declare class HTMLButtonElement extends HTMLButtonElement_base {}

so everything is fully resolved at compile-time!

@cowboyd
cowboyd removed this pull request from stack #98 November 19, 2026 17:17
@cowboyd
cowboyd added this pull request to stack #106 November 19, 2026 17:18
@cowboyd

cowboyd commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

no stacks on stacks

@cowboyd cowboyd closed this Nov 20, 2026
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.

2 participants