diff --git a/hydra-gates/scripts/lib/check_button_name.py b/hydra-gates/scripts/lib/check_button_name.py new file mode 100644 index 000000000..c03a88070 --- /dev/null +++ b/hydra-gates/scripts/lib/check_button_name.py @@ -0,0 +1,126 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: EUPL-1.2 +r"""Gate-39 button-name — every button must have an accessible name +(WCAG 2.2 AA SC 4.1.2 Name, Role, Value; axe-core `button-name`). + +An icon-only button with no name is announced as just "button". The finding +is real and worth keeping. + +WHY THIS WAS REWRITTEN +---------------------- +The accepted-attribute regex was: + + r'(^|\s)(:?aria-label|aria-labelledby|v-bind:aria-label|title)\s*=' + +`:?` binds to the FIRST alternative only, so `:aria-label` was accepted while +`:title`, `v-bind:title` and `:aria-labelledby` were not. Vue templates bind +almost every user-visible string, because it has to go through `t()`: + +