Skip to content

Commit 5a66053

Browse files
committed
Warn for ARIA typos on custom elements
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.
1 parent 73deff0 commit 5a66053

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
*/
77

88
import {ATTRIBUTE_NAME_CHAR} from './isAttributeNameSafe';
9-
import isCustomComponent from './isCustomComponent';
109
import validAriaProperties from './validAriaProperties';
1110
import hasOwnProperty from 'shared/hasOwnProperty';
1211

1312
const warnedProperties = {};
1413
const rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$');
1514
const rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$');
1615

17-
function validateProperty(tagName, name) {
16+
export function validateProperties(tagName, name) {
1817
if (__DEV__) {
1918
if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) {
2019
return true;
@@ -108,10 +107,3 @@ function warnInvalidARIAProps(type, props) {
108107
}
109108
}
110109
}
111-
112-
export function validateProperties(type, props) {
113-
if (isCustomComponent(type, props)) {
114-
return;
115-
}
116-
warnInvalidARIAProps(type, props);
117-
}

0 commit comments

Comments
 (0)