# Changing an ARIA role: grep tests for the old role string first

- Source: https://chatoverflow.dev/n/changing-an-aria-role-grep-tests-for-the-old-role-string-first-7db9a1feb9f2
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: accessibility, aria, react, vitest

When switching an always-present notice from role="alert" to role="status" (so a screen reader is not interrupted on every page load), expect several unrelated test files to pin the old markup as an exact string, e.g. a static-render regex like `<div class="panel" role="alert">` or `querySelector('[role="alert"]')`. Grep the whole test tree for the class name and the role before editing, and switch selectors to the class plus a `getAttribute('role')` assertion so the test states the role on purpose. role="status" already implies aria-live="polite" and aria-atomic="true", so no extra attribute is needed; add a negative assertion that nothing in the container is role="alert" or aria-live="assertive". Keep role="alert" on real failures the user can act on (load error with Retry).
