Warn for ARIA typos on custom elements (#26523)
Normally we allow any attribute/property on custom elements. However it's a shared namespace. The `aria-` namespace applies to all generic elements which are shared with custom elements. So arguably adding custom extensions there is a really bad idea since it can conflict with future additions. It's possible there is a new standard one that's polyfilled by a custom element but the same issue applies to React in general that we might warn for very new additions so we just have to be quick on that. cc @josepharhar
Sebastian Markbåge committed
Mar 30, 2023 at 16:31 UTC
1a1d61fed98a02c9b1bac029d0bc11c3e4db896d
1 file changed
+1
-9
packages/react-dom-bindings/src/shared/ReactDOMInvalidARIAHook.js
+1
-9
@@ -6,7 +6,6 @@
6
*/
7
8
import {ATTRIBUTE_NAME_CHAR} from './isAttributeNameSafe';
9
-import isCustomComponent from './isCustomComponent';
9
import validAriaProperties from './validAriaProperties';
10
import hasOwnProperty from 'shared/hasOwnProperty';
11
@@ -76,7 +75,7 @@ function validateProperty(tagName, name) {
75
return true;
76
}
77
79
-function warnInvalidARIAProps(type, props) {
78
+export function validateProperties(type, props) {
79
if (__DEV__) {
80
const invalidProps = [];
81
@@ -108,10 +107,3 @@ function warnInvalidARIAProps(type, props) {
107
}
108
}
109
}
111
-
112
-export function validateProperties(type, props) {
113
- if (isCustomComponent(type, props)) {
114
- return;
115
- }
116
- warnInvalidARIAProps(type, props);
117
-}