Skip to content

fix(gather-internals): handle non-HTMLElement nodes#5161

Merged
straker merged 1 commit into
developfrom
gather-internals-node
Jun 29, 2026
Merged

fix(gather-internals): handle non-HTMLElement nodes#5161
straker merged 1 commit into
developfrom
gather-internals-node

Conversation

@straker

@straker straker commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Use Node instead of HTMLElement when checking the element internals prop value so we include all node types, such as SVGs. This is the follow up to a similar problem in the get-aria-value pr.

I also added an eslint rule to prevent us from using HTMLElements in the future so we don't make the same mistake again.

@straker straker requested a review from a team as a code owner June 11, 2026 15:38
// convert idref to node ancestry
// aria props can use unattached nodes but those won't be used by the browser to calculate the prop value
if (value instanceof globalThis.HTMLElement) {
if (value instanceof globalThis.Node) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This may need to be Element? I tested it out, you can't assign text nodes to ariaLabelledbyElement. So that's good. In practice this shouldn't matter, so I think it's fine.

@straker straker merged commit 06e84c3 into develop Jun 29, 2026
23 checks passed
@straker straker deleted the gather-internals-node branch June 29, 2026 15:56
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