Skip to content

Conversation

@rschristian
Copy link
Member

@rschristian rschristian commented Aug 8, 2025

Revert of #4876

All of the per-element types (AnchorHTMLAttributes, AreaHTMLAttributes, etc) via core & compat are now interfaces again (as they are in React), with the new accessible types exported & hooked up to IntrinsicElements so that users still get correct ARIA type checking. Users will now need to augment the Accessible-prefixed types for a few elements, which may be a surprise & needs documentation for sure, but I think that's a better tradeoff; more people will import element types to extend or consume than will need to augment (say) all anchor tags globally.

I spent so much time working on those aria roles & reading the spec that I suppose I overestimated/forgot how many elements in total need discriminated unions and can be represented properly, which turns out to be only <a>, <area>, <img>, <input>, and <select>. In my head there were a lot more 😅

to offer older interfaces, hooking the new types up
to 'IntrinsicElements'
@rschristian rschristian changed the title refactor: Avoid breaking change for element types by continuing refactor: Avoid breaking change for ARIA element types Aug 8, 2025
Comment on lines 1596 to 1609
export type AnchorHTMLAttributes<T extends EventTarget = HTMLAnchorElement> = Omit<
export type AccessibleAnchorHTMLAttributes<T extends EventTarget = HTMLAnchorElement> = Omit<
PartialAnchorHTMLAttributes<T>,
'role'
> &
AnchorAriaRoles;

export interface AnchorHTMLAttributes<T extends EventTarget = HTMLAnchorElement> extends PartialAnchorHTMLAttributes<T> {
href?: Signalish<string | undefined>;
role?: Signalish<AriaRole | undefined>;
}
Copy link
Member Author

@rschristian rschristian Aug 8, 2025

Choose a reason for hiding this comment

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

This is all that the PR does: makes plain & wide interfaces to compliment the specific accessible types.

@coveralls
Copy link

coveralls commented Aug 8, 2025

Coverage Status

coverage: 99.539%. remained the same
when pulling 42ee11c on types/accessible-without-breaking-change
into 869968b on main.

@rschristian rschristian force-pushed the types/accessible-without-breaking-change branch from f64ab2e to 42ee11c Compare August 9, 2025 22:34
@rschristian rschristian merged commit b0d9195 into main Aug 9, 2025
5 checks passed
@rschristian rschristian deleted the types/accessible-without-breaking-change branch August 9, 2025 22:36
@JoviDeCroock JoviDeCroock mentioned this pull request Aug 19, 2025
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.

4 participants