NeovaNền tảng SEO chuyên sâu

Giá trị thuộc tính role không phải role ARIA hợp lệ

Trong Neova Chạy ngay từ lần crawl: không cần thiết lập gì.

Quy tắc được rà soát lần cuối ngày 17 tháng 10 năm 2026 · Hướng dẫn cập nhật ngày 7 tháng 7 năm 2026

WCAG 4.1.2 yêu cầu role hợp lệ. Trình duyệt bỏ qua role mà chúng không biết, nên người dùng trình đọc màn hình không nhận được role mà tác giả muốn.

Bạn có thể làm gì

Thay giá trị bằng một role WAI-ARIA đã được định nghĩa và không trừu tượng, hoặc xóa thuộc tính role.

Vì sao Neova đánh dấu

  • Trình duyệt bỏ qua giá trị role mà chúng không biết, nên phần tử quay về role mặc định.
  • Khi đó người dùng trình đọc màn hình không nhận được hành vi tác giả muốn, như một tab hay một dialog.
  • WCAG 4.1.2 (cấp độ A) yêu cầu role hợp lệ; role trừu tượng cũng không được phép dùng trong markup.

Nguồn

Hướng dẫn đầy đủ

Phần này tạm thời còn bằng tiếng Anh.

TL;DR: This check flags any element whose role attribute holds a value that is not a real ARIA role. Assistive technology ignores or misreads unknown roles, so the element loses the meaning you intended (WCAG 4.1.2). Fix it by correcting the typo, swapping in a valid role from the ARIA spec, or removing role entirely and using the matching native HTML element.

What This Means

ARIA (Accessible Rich Internet Applications) lets you attach a role to an element so screen readers and other assistive technology understand what it is, for example a button, a navigation region, or a dialog. The catch is that the role value must come from a fixed list defined in the WAI-ARIA specification. This audit issue fires when an element carries a role whose value is not on that list.

A role becomes invalid in three common ways: a misspelling such as role="navigaton"; a made-up value that sounds plausible but does not exist, such as role="dropdown"; or an abstract role that the spec reserves for its own taxonomy and forbids in content, such as role="widget" or role="input".

Why It Matters

When a role value is not recognized, the browser and assistive technology do not silently guess what you meant. They ignore the invalid role and fall back to the element's native semantics, or expose nothing useful at all. A screen reader user then hears a generic, unlabeled element instead of the button, tab, or dialog you built, so the control becomes confusing or unusable. Abstract roles are worse than ignored: user agents are required by spec not to map them to the accessibility API, so they never reach the user.

This maps to WCAG 2.1 Success Criterion 4.1.2 Name, Role, Value, which requires that the role of every user-interface component be programmatically determinable. Deque rates the underlying axe rule as a Critical impact issue because a broken role can hide an interactive component from everyone who relies on assistive technology. There is a growing second reason to care: the same machine-readable semantics that help screen readers also help AI crawlers and answer engines parse your page structure, which is why clean, valid markup is part of building a machine-readable web.

The Invalid Roles You Will Actually See

Almost every real-world failure is one of a handful of patterns. Find the row that matches your flagged value, and the fix column tells you where to go.

Flagged Value Why It Fails What to Use Instead
role="navigaton" typo role="navigation" or <nav>
role="dropdown" not a real role role="menu" or role="listbox"
role="tabpanel" (misused) real role, wrong element keep, but pair with a real tab
role="widget" abstract, forbidden in content a concrete role like button
role="input" abstract, forbidden in content a native <input>, no role

How to Detect It

Because a role is either in the spec or it is not, automated tools catch this with near-perfect accuracy. Any of these three will name the bad value.

  1. axe DevTools (browser extension). Run a scan; the rule is aria-roles, "ARIA roles used must conform to valid values." It reports the element and the exact unrecognized token so you can correct it in place.
  2. Google Lighthouse. In the Chrome Lighthouse Accessibility report the same check appears as "[role] values are not valid," listing every failing node on the page at once.
  3. ARIA DevTools (browser extension). It renders the accessibility tree; an element you expected to appear as a dialog or tab that instead shows up as a plain generic node is your invalid role, caught by what the value did (nothing) rather than how it was spelled.

How to Fix It

Look at the flagged value and decide which of three fixes applies. First, if it is a typo, correct the spelling. Second, if the concept exists in ARIA under a different name, swap in the real role. Third, and best, if a native HTML element already carries that meaning, drop the role and use the element instead, because native semantics are more reliable than ARIA.

<!-- Invalid: typo, made-up value, and abstract role -->
<div role="naviagtion">...</div>
<div role="dropdown">...</div>
<span role="widget">...</span>

<!-- Fixed: corrected spelling -->
<div role="navigation">...</div>

<!-- Fixed: real ARIA role for the concept -->
<ul role="menu">...</ul>

<!-- Best: use native HTML, no role needed -->
<nav>...</nav>
<button type="button">Open menu</button>

After you assign a valid role, confirm the role still fits the element and that you have supplied any states or properties that role requires. A correct role with missing support can trigger sibling issues such as required ARIA attributes must be provided and elements must only use allowed ARIA attributes. Re-run the scan to confirm the element clears.

False Positives

This rule has very few false positives, because a role is either in the spec or it is not. Two situations look like errors but are valid. A role attribute can hold a space-separated fallback list, such as role="doc-chapter region", where the browser uses the first valid token; axe accepts this. Newer roles, including the DPUB-ARIA and Graphics ARIA extensions, are valid even though they may look unfamiliar. If you believe a flag is wrong, verify the exact value against the spec rather than assuming the scanner is mistaken, since the most common "false positive" turns out to be a real typo.

FAQ

Where Is the Official List of Valid Roles?

The WAI-ARIA specification and the MDN ARIA roles reference both list every non-abstract role. If a value is not in those documents, it is not valid.

Why Can't I Use Abstract Roles Like Widget or Input?

Abstract roles exist only to organize the ARIA taxonomy. The spec states authors must not use them in content, and user agents are required not to map them to the accessibility API, so they never reach assistive technology.

Is Removing the Role Safe?

If a native HTML element already conveys the same meaning, yes, and it is the preferred fix. Only keep an explicit role when no native element matches the behavior you are building.

Does an Invalid Role Break My Whole Page?

Not the page, but it breaks that element for assistive-technology users. Because the impact is rated Critical, treat each instance as a real defect rather than a cosmetic warning.

Want every ARIA and accessibility issue fixed for good?

Our team audits your markup end to end and hands you a prioritized fix plan.

Tìm lỗi này trên trang của bạn

Neova chạy mục kiểm tra này và mọi mục khác trong mỗi lần crawl, rồi viết cách sửa thành ticket cho nhóm của bạn.

  • Ứng dụng máy tính cho Mac, Windows và Linux
  • Tất cả 696 mục kiểm tra, mỗi mục kèm nguồn
  • Search Console và Analytics 4, kết nối chỉ đọc
  • Ticket sang Jira, Linear và Asana

Tải Neova Gói Desktop Free, hoặc dùng thử Solo miễn phí 14 ngày, không cần thẻ.

Tất cả mục kiểm tra Khả năng truy cập · Hướng dẫn · Thư viện mục kiểm tra

Do Neova Labs biên soạn · Quay lại Thư viện mục kiểm tra