Add the iframe credentialless prop#663
Conversation
Greptile SummaryThis PR adds first-class support for the iframe
Confidence Score: 4/5
Important Files Changed
Last reviewed commit: 5901780 |
| case 'async': | ||
| case 'autoPlay': | ||
| case 'controls': | ||
| case 'credentialless': |
There was a problem hiding this comment.
Consider adding an empty-string warning like inert
Since the PR description notes that the current workaround is credentialless="", users upgrading will likely pass an empty string initially. The inert attribute (line 740) was added with a __DEV__ warning for empty-string values for exactly this reason — it falls through to the boolean list below after emitting the warning.
It may be worth giving credentialless the same treatment: adding a dedicated case 'credentialless' block above the fallthrough list (alongside inert) that warns when value === '', so users get a helpful nudge to switch to credentialless={true}. This would affect 3 locations: setProp, pushAttribute in ReactFizzConfigDOM.js, and diffHydratedGenericElement.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/react-dom-bindings/src/client/ReactDOMComponent.js
Line: 759
Comment:
**Consider adding an empty-string warning like `inert`**
Since the PR description notes that the current workaround is `credentialless=""`, users upgrading will likely pass an empty string initially. The `inert` attribute (line 740) was added with a `__DEV__` warning for empty-string values for exactly this reason — it falls through to the boolean list below after emitting the warning.
It may be worth giving `credentialless` the same treatment: adding a dedicated `case 'credentialless'` block above the fallthrough list (alongside `inert`) that warns when `value === ''`, so users get a helpful nudge to switch to `credentialless={true}`. This would affect 3 locations: `setProp`, `pushAttribute` in `ReactFizzConfigDOM.js`, and `diffHydratedGenericElement`.
How can I resolve this? If you propose a fix, please make it concise.
Mirror of facebook/react#35967
Original author: jamesbvaughan
Summary
This adds support for the iframe
credentiallessattribute. This is a (currently experimental) attribute that is useful for running iframes in pages using cross-origin isolation.https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/IFrame_credentialless
The current workaround in React projects is to use
credentialless=""(plus a//@ts-expect-errorcomment if you're using TypeScript).How did you test this change?
I updated the automated tests and ran them. I'm having trouble with my local React build so I haven't yet been able to test this with my project, but I'll update this PR description once I have.