From 1a1d61fed98a02c9b1bac029d0bc11c3e4db896d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Markb=C3=A5ge?= Date: Thu, 30 Mar 2023 16:31:15 -0400 Subject: [PATCH] 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 --- .../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); -}