Skip to content

Commit

Permalink
Warn for ARIA typos on custom elements
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sebmarkbage committed Mar 30, 2023
1 parent 73deff0 commit 9220287
Showing 1 changed file with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import {ATTRIBUTE_NAME_CHAR} from './isAttributeNameSafe';
import isCustomComponent from './isCustomComponent';
import validAriaProperties from './validAriaProperties';
import hasOwnProperty from 'shared/hasOwnProperty';

Expand Down Expand Up @@ -76,7 +75,7 @@ function validateProperty(tagName, name) {
return true;
}

function warnInvalidARIAProps(type, props) {
export function validateProperties(type, props) {
if (__DEV__) {
const invalidProps = [];

Expand Down Expand Up @@ -108,10 +107,3 @@ function warnInvalidARIAProps(type, props) {
}
}
}

export function validateProperties(type, props) {
if (isCustomComponent(type, props)) {
return;
}
warnInvalidARIAProps(type, props);
}

0 comments on commit 9220287

Please sign in to comment.