Skip to content

Commit 94643c3

Browse files
authored
Suggest correct casing for misspelled credentialless iframe attribute (#36322)
## Summary Follow-up to #36148 (which added credentialless as a recognized boolean attribute for iframes). Adds credentialless to possibleStandardNames so React's dev warning can suggest the correct casing when users write it as Credentialless (or another incorrect case). Includes an SSR test asserting the "Did you mean credentialless?" warning fires. ## Test plan - yarn test ReactDOMComponent passes, including the new should warn about incorrect casing on the credentialless property (ssr) case
1 parent 306a01b commit 94643c3

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

packages/react-dom-bindings/src/shared/possibleStandardNames.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const possibleStandardNames = {
4444
controls: 'controls',
4545
controlslist: 'controlsList',
4646
coords: 'coords',
47+
credentialless: 'credentialless',
4748
crossorigin: 'crossOrigin',
4849
dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
4950
data: 'data',

packages/react-dom/src/__tests__/ReactDOMComponent-test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,6 +2678,16 @@ describe('ReactDOMComponent', () => {
26782678
]);
26792679
});
26802680

2681+
it('should warn about incorrect casing on the credentialless property (ssr)', () => {
2682+
ReactDOMServer.renderToString(
2683+
React.createElement('iframe', {Credentialless: true}),
2684+
);
2685+
assertConsoleErrorDev([
2686+
'Invalid DOM property `Credentialless`. Did you mean `credentialless`?\n' +
2687+
' in iframe (at **)',
2688+
]);
2689+
});
2690+
26812691
it('should warn about incorrect casing on event handlers (ssr)', () => {
26822692
ReactDOMServer.renderToString(
26832693
React.createElement('input', {type: 'text', oninput: '1'}),

0 commit comments

Comments
 (0)