diff --git a/packages/mui-base/src/utils/mergeReactProps.ts b/packages/mui-base/src/utils/mergeReactProps.ts index cb6cfc188..2396f8ff9 100644 --- a/packages/mui-base/src/utils/mergeReactProps.ts +++ b/packages/mui-base/src/utils/mergeReactProps.ts @@ -17,7 +17,14 @@ export function mergeReactProps( ): WithBaseUIEvent> { return Object.entries(externalProps).reduce( (acc, [key, value]) => { - if (/^on[A-Z]/.test(key) && typeof value === 'function') { + if ( + // This approach is more efficient than using a regex. + key[0] === 'o' && + key[1] === 'n' && + key.charCodeAt(2) >= 65 /* A */ && + key.charCodeAt(2) <= 90 /* Z */ && + typeof value === 'function' + ) { acc[key] = (event: React.SyntheticEvent) => { let isPrevented = false;