@@ -73,6 +73,7 @@ import {
73
73
disableIEWorkarounds ,
74
74
enableTrustedTypesIntegration ,
75
75
enableFilterEmptyStringAttributesDOM ,
76
+ enableNewBooleanProps ,
76
77
} from 'shared/ReactFeatureFlags' ;
77
78
import {
78
79
mediaEventTypes ,
@@ -86,8 +87,10 @@ let didWarnFormActionType = false;
86
87
let didWarnFormActionName = false ;
87
88
let didWarnFormActionTarget = false ;
88
89
let didWarnFormActionMethod = false ;
90
+ let didWarnForNewBooleanPropsWithEmptyValue : { [ string ] : boolean } ;
89
91
let canDiffStyleForHydrationWarning ;
90
92
if ( __DEV__ ) {
93
+ didWarnForNewBooleanPropsWithEmptyValue = { } ;
91
94
// IE 11 parses & normalizes the style attribute as opposed to other
92
95
// browsers. It adds spaces and sorts the properties in some
93
96
// non-alphabetical order. Handling that would require sorting CSS
@@ -712,6 +715,25 @@ function setProp(
712
715
break ;
713
716
}
714
717
// 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
715
737
case 'allowFullScreen' :
716
738
case 'async' :
717
739
case 'autoPlay' :
@@ -2663,6 +2685,33 @@ function diffHydratedGenericElement(
2663
2685
extraAttributes ,
2664
2686
) ;
2665
2687
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
2666
2715
default : {
2667
2716
if (
2668
2717
// shouldIgnoreAttribute
0 commit comments