Add credentialless as a recognized boolean attribute for iframes#36148
Add credentialless as a recognized boolean attribute for iframes#36148
Conversation
## Summary
The `credentialless` attribute is a boolean HTML attribute for `<iframe>` elements
that loads the iframe in a new, ephemeral context without access to the parent's
credentials (cookies, client certificates, etc.). This change adds it to all
boolean attribute switch/case lists in React DOM so it is properly handled as a
boolean (set when true, removed when false) rather than being treated as an
unknown string attribute.
Changes:
- ReactDOMComponent.js: Added to both `setProp` and `diffHydratedGenericElement`
- ReactFizzConfigDOM.js: Added to `pushAttribute` for server-side rendering
- ReactDOMUnknownPropertyHook.js: Added to both validation switch/case lists
## Test plan
- Added unit test in DOMPropertyOperations-test.js verifying `credentialless={true}`
sets the attribute to `''` and `credentialless={false}` removes it
- Added server rendering tests in ReactDOMServerIntegrationAttributes-test.js for
both true and false values
- All tests pass in source and www channels (590 tests each)
- Flow type checking passes (dom-node renderer)
- Prettier and lint pass
|
Comparing: 3cb2c42...8ffe9dd Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
mahdirajaee
left a comment
There was a problem hiding this comment.
Clean change. The credentialless attribute is indeed a boolean attribute specified in the HTML spec for iframes (currently behind the Anonymous iframe origin trial but shipping in Chromium-based browsers).
A few observations:
-
Alphabetical ordering is correct —
credentiallessslots in properly betweencontrolsanddefaultacross all four switch statements. Good consistency. -
All relevant paths are covered — client-side (
ReactDOMComponent.js), SSR (ReactFizzConfigDOM.js), and validation (ReactDOMUnknownPropertyHook.js). This ensures the attribute is recognized regardless of render environment. -
Test coverage looks solid — both the boolean
true/falsetoggle test and the string"true"warning test are present, which matches the existing pattern for other boolean attributes likeallowFullScreen. -
One thing worth noting — unlike
allowFullScreenwhich is scoped to iframes in the spec but accepted on any element by React,credentiallessis also iframe-specific. The current approach (accepting it on any element) is consistent with how React handles other boolean attributes, so this is fine for now, but a future improvement could be element-scoped validation.
LGTM. Straightforward addition following the established pattern.
Summary
The
credentiallessattribute is a boolean HTML attribute for<iframe>elements that loads the iframe in a new, ephemeral context without access to the parent's credentials (cookies, client certificates, etc.). This change adds it to all boolean attribute switch/case lists in React DOM so it is properly handled as a boolean (set when true, removed when false) rather than being treated as an unknown string attribute.Per the Anonymous iframe spec (WICG):
Changes:
setPropanddiffHydratedGenericElementpushAttributefor server-side renderingTest plan
credentialless={true}sets the attribute to''andcredentialless={false}removes it