From 922028783ec449a0891ace68ba5001e17fd2beb5 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Thu, 30 Mar 2023 15:27:11 -0400 Subject: [PATCH] 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. --- .../src/shared/ReactDOMInvalidARIAHook.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/react-dom-bindings/src/shared/ReactDOMInvalidARIAHook.js b/packages/react-dom-bindings/src/shared/ReactDOMInvalidARIAHook.js index 1546c32ed965e..4bc62e3de4ddb 100644 --- a/packages/react-dom-bindings/src/shared/ReactDOMInvalidARIAHook.js +++ b/packages/react-dom-bindings/src/shared/ReactDOMInvalidARIAHook.js @@ -6,7 +6,6 @@ */ import {ATTRIBUTE_NAME_CHAR} from './isAttributeNameSafe'; -import isCustomComponent from './isCustomComponent'; import validAriaProperties from './validAriaProperties'; import hasOwnProperty from 'shared/hasOwnProperty'; @@ -76,7 +75,7 @@ function validateProperty(tagName, name) { return true; } -function warnInvalidARIAProps(type, props) { +export function validateProperties(type, props) { if (__DEV__) { const invalidProps = []; @@ -108,10 +107,3 @@ function warnInvalidARIAProps(type, props) { } } } - -export function validateProperties(type, props) { - if (isCustomComponent(type, props)) { - return; - } - warnInvalidARIAProps(type, props); -}