Skip to content

fix(types): add declarative shadow DOM attributes to <template> - #5338

Merged
JoviDeCroock merged 4 commits into
preactjs:mainfrom
b84330808:fix/template-shadowroot-types
Oct 28, 2026
Merged

JoviDeCroock merged 4 commits into
preactjs:mainfrom
b84330808:fix/template-shadowroot-types

Conversation

@b84330808

Copy link
Copy Markdown
Contributor

Fixes #5337

<template shadowrootmode="open"> didn't type check because TemplateHTMLAttributes had no shadowroot* attributes. This adds shadowrootmode ('open' | 'closed') and the related shadowrootclonable, shadowrootdelegatesfocus and shadowrootserializable booleans, each with its camelCase form like the other attributes in dom.d.ts. I added type tests to test/ts/dom-attributes.test-d.tsx, including one that an invalid mode is rejected.

I used Claude Code to write this change.

`<template shadowrootmode="open">` failed to type check because
TemplateHTMLAttributes had no shadowroot* attributes. Add shadowrootmode
('open' | 'closed') and the shadowrootclonable, shadowrootdelegatesfocus
and shadowrootserializable booleans, each with its camelCase property
form like the other attributes in dom.d.ts.

Fixes preactjs#5337

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread test/ts/dom-attributes.test-d.tsx Resolved
Comment thread test/ts/dom-attributes.test-d.tsx Resolved
Comment thread test/ts/dom-attributes.test-d.tsx Resolved
b84330808 and others added 2 commits October 28, 2026 16:52
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Per review: these type additions do not need their own tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@b84330808

Copy link
Copy Markdown
Contributor Author

Makes sense, dropped the tests. Thanks for the quick review!

My previous commit re-added them by mistake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JoviDeCroock
JoviDeCroock merged commit 2788c12 into preactjs:main Oct 28, 2026
4 checks passed
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 99.857%. remained the same — b84330808:fix/template-shadowroot-types into preactjs:main

@JoviDeCroock JoviDeCroock mentioned this pull request Oct 30, 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.

shadowrootmode is missing from <template> JSX types

4 participants