Fixing the “Invalid ARIA attribute ariaLabel” Warning in React
The message Invalid ARIA attribute `ariaLabel`. Did you mean `aria-label`? appears when you write aria-label in camelCase as ariaLabel. In React, aria-* attributes use the same hyphenated names as in HTML. You usually set this attribute on icon-only buttons such as × (close) or ≡ (menu) to give screen readers a name to announce. If you misspell it, the button stays without a name.
In my test environment, I caused the warning on purpose and copied the message as it appeared. Then I confirmed that changing it to aria-label removes the warning and gives the button a name.
The test environment was Ubuntu 24.04 and Node.js 22.23.5. I used a project created with the react-ts template from npm create vite@latest (react and react-dom 19.3.1, @types/react 19.3.3, Vite 8.3.8, TypeScript 7.0.2, oxlint 1.95.0), and wrapped the components in StrictMode. I opened the page in Chromium 158 driven by Playwright 1.63.0, and read the button names with Playwright's ariaSnapshot(). I did not test with a real screen reader, with frameworks such as Next.js, or with browsers other than Chromium.
Triggering the warning on an icon button
When I wrote ariaLabel directly on a <button>, the TypeScript type check (npx tsc -p tsconfig.app.json --noEmit) failed. In @types/react, the type for this attribute is defined under the name aria-label, and the second line of the error mentions that name.
src/BadDirect.tsx(4,27): error TS2322: Type '{ type: "button"; ariaLabel: string; children: string; }' is not assignable to type 'DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>'.
Property 'ariaLabel' does not exist on type 'DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>'. Did you mean '"aria-label"'?
The type check misses the problem when your own component accepts an ariaLabel prop and passes everything to <button> with {...props}. In the following IconButton, the type check reported no errors.
import type { ComponentProps } from 'react';
// Wrong: accepts an ariaLabel prop and passes it through to the button as is
type IconButtonProps = ComponentProps<'button'> & { ariaLabel: string };
export function IconButton(props: IconButtonProps) {
return <button type="button" {...props} />;
}
import { IconButton } from './IconButton';
export default function BadIconButton() {
return <IconButton ariaLabel="閉じる">×</IconButton>;
}
When I opened the page on the same development server that npm run dev starts (it runs vite), the DevTools console showed the following warning as a red console.error line.
Invalid ARIA attribute `ariaLabel`. Did you mean `aria-label`?
The message means: "ariaLabel is not a valid ARIA attribute. Did you mean aria-label?" The warning appeared, but the button was still displayed. The lint tool oxlint, which the template includes, did not report a warning with the template's settings.

The button name stays as "×"
The HTML of the page at this point was as follows.
<button type="button" arialabel="閉じる">×</button>
The button has an arialabel attribute, which is not an ARIA attribute. The name Playwright read for the button was "×". Not only did the warning appear, but the label "Close" I meant to supply was not used as the button's name.
Passing it as aria-label
In IconButton, I took ariaLabel out with destructuring and put its value into aria-label. I kept passing the remaining props (...rest) to <button> as before.
import type { ComponentProps } from 'react';
// Fixed: take out ariaLabel and pass it as aria-label
type IconButtonProps = ComponentProps<'button'> & { ariaLabel: string };
function GoodButton({ ariaLabel, ...rest }: IconButtonProps) {
return <button type="button" aria-label={ariaLabel} {...rest} />;
}
export default function GoodIconButton() {
return <GoodButton ariaLabel="閉じる">×</GoodButton>;
}
When I opened the page on the development server, the warning was gone. The console showed only the React DevTools message. The HTML became <button type="button" aria-label="閉じる">×</button>, and the name Playwright read for the button changed to "Close".

If you don't want the component's prop to be camelCase, you can remove ariaLabel from IconButtonProps and write <IconButton aria-label="閉じる"> at the call site. ComponentProps<'button'> already includes aria-label, so the type check passes. I tried this too: there was no warning, the HTML was <button type="button" aria-label="閉じる">×</button>, and the button name was "Close".
The React reference states that React uses exactly the same ARIA attribute names as HTML. Some props, such as htmlFor and onClick, are written in camelCase, so you may want to match that for aria-*, but aria-* stays hyphenated. The MDN page on aria-label explains what the attribute is for, with an example of a button that has no text.
The warning message depends on how the name is misspelled
I also tested aria-labelledby (which uses the text of another element, such as a heading, as the name) and aria-describedby. I prepared four misspelled names and passed them with {...extra} to a <div> with role="region".
// Wrong: misspelled names and camelCase names
const extra = { ariaLabelledBy: 'title', 'aria-labeledby': 'title', ariaLabeledBy: 'title', 'aria-Describedby': 'hint' };
Each of the four names produced a different message.
| Name written | Message shown |
|---|---|
ariaLabelledBy |
Invalid ARIA attribute `ariaLabelledBy`. Did you mean `aria-labelledby`? |
ariaLabeledBy |
Invalid ARIA attribute `ariaLabeledBy`. ARIA attributes follow the pattern aria-* and must be lowercase. |
aria-Describedby |
Unknown ARIA attribute `aria-Describedby`. Did you mean `aria-describedby`? |
aria-labeledby |
Invalid aria prop `aria-labeledby` on <div> tag. For details, see https://react.dev/link/invalid-aria-props |
When changing a camelCase name to a lowercase hyphenated name gives the correct name, the warning suggests it with Did you mean. When the name is still wrong after the change, as with ariaLabeledBy (missing one "l"), the message only says that ARIA attributes follow the aria-* pattern and must be lowercase. The hyphenated but misspelled aria-labeledby produced a different message, Invalid aria prop. The linked explanation page for that message also lists aria-labelledby as a name that is often misspelled.
In this run of the HTML, only aria-Describedby was attached correctly, as the lowercase aria-describedby. The other three became meaningless attributes: arialabelledby, aria-labeledby, and arialabeledby. No name was given to the region, and the name Playwright read was just region with no name. When I wrote aria-labelledby="title" and aria-describedby="hint" correctly, all four warnings disappeared, and the heading text "Announcements" became the region's name.
A warning for the same name appears only once, however many places use it
I also placed two IconButtons, each using ariaLabel, on one page. The warning appeared only once. In the HTML, both buttons had arialabel. In the development build of react-dom 19.3.1, React remembers the names it has already warned about and does not warn again for the same name.
Even if you see the console warning only once, the same mistake may appear in several places. After fixing it, search your editor for ariaLabel and similar names to make sure none remain.
The production build does not show the warning
I built for production and opened the output with npx vite preview. Because BadDirect.tsx causes a type error, I built with npx vite build instead of npm run build (which runs tsc -b && vite build). The console showed no warnings on the IconButton page or on the page with the four misspelled names. The HTML was the same as in the development server, with meaningless attributes such as arialabel still attached. The production code of react-dom and the built output did not contain the string Invalid ARIA attribute at all.
In production, the buttons and regions stay without names, and nothing warns you. The appearance does not change, so you need to fix this when you notice the warning in the development console.





