@@ -73,6 +73,7 @@ import {
7373 disableIEWorkarounds ,
7474 enableTrustedTypesIntegration ,
7575 enableFilterEmptyStringAttributesDOM ,
76+ enableNewBooleanProps ,
7677} from 'shared/ReactFeatureFlags' ;
7778import {
7879 mediaEventTypes ,
@@ -86,8 +87,10 @@ let didWarnFormActionType = false;
8687let didWarnFormActionName = false ;
8788let didWarnFormActionTarget = false ;
8889let didWarnFormActionMethod = false ;
90+ let didWarnForNewBooleanPropsWithEmptyValue : { [ string ] : boolean } ;
8991let canDiffStyleForHydrationWarning ;
9092if ( __DEV__ ) {
93+ didWarnForNewBooleanPropsWithEmptyValue = { } ;
9194 // IE 11 parses & normalizes the style attribute as opposed to other
9295 // browsers. It adds spaces and sorts the properties in some
9396 // non-alphabetical order. Handling that would require sorting CSS
@@ -712,6 +715,25 @@ function setProp(
712715 break ;
713716 }
714717 // Boolean
718+ case 'inert' :
719+ if ( ! enableNewBooleanProps ) {
720+ setValueForAttribute ( domElement , key , value ) ;
721+ break ;
722+ } else {
723+ if ( __DEV__ ) {
724+ if ( value === '' && ! didWarnForNewBooleanPropsWithEmptyValue [ key ] ) {
725+ didWarnForNewBooleanPropsWithEmptyValue [ key ] = true ;
726+ console . error (
727+ 'Received an empty string for a boolean attribute `%s`. ' +
728+ 'This will treat the attribute as if it were false. ' +
729+ 'Either pass `false` to silence this warning, or ' +
730+ 'pass `true` if you used an empty string in earlier versions of React to indicate this attribute is true.' ,
731+ key ,
732+ ) ;
733+ }
734+ }
735+ }
736+ // fallthrough for new boolean props without the flag on
715737 case 'allowFullScreen' :
716738 case 'async' :
717739 case 'autoPlay' :
@@ -2663,6 +2685,33 @@ function diffHydratedGenericElement(
26632685 extraAttributes ,
26642686 ) ;
26652687 continue ;
2688+ case 'inert ':
2689+ if ( enableNewBooleanProps ) {
2690+ if ( __DEV__ ) {
2691+ if (
2692+ value === '' &&
2693+ ! didWarnForNewBooleanPropsWithEmptyValue [ propKey ]
2694+ ) {
2695+ didWarnForNewBooleanPropsWithEmptyValue [ propKey ] = true ;
2696+ console . error (
2697+ 'Received an empty string for a boolean attribute `%s`. ' +
2698+ 'This will treat the attribute as if it were false. ' +
2699+ 'Either pass `false` to silence this warning, or ' +
2700+ 'pass `true` if you used an empty string in earlier versions of React to indicate this attribute is true.' ,
2701+ propKey ,
2702+ ) ;
2703+ }
2704+ }
2705+ hydrateBooleanAttribute (
2706+ domElement ,
2707+ propKey ,
2708+ propKey ,
2709+ value ,
2710+ extraAttributes ,
2711+ ) ;
2712+ continue ;
2713+ }
2714+ // fallthrough for new boolean props without the flag on
26662715 default : {
26672716 if (
26682717 // shouldIgnoreAttribute
0 commit comments