diff --git a/AGENTS.md b/AGENTS.md index 637642b6..ee8ac479 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -42,6 +42,11 @@ Run the unit tests with Vitest: npm run test-unit ``` +## Accessibility + +- Every input, select and button needs an accessible name. `InputString`, `InputNumber`, `InputSelect` and `InputButton` accept an `aria-label`. +- When a control repeats, as in the rows of an array or collection field, give each copy its own label that names the row and what it edits (for example `… row 2 X offset`), and pass it through `t()`. Controls that share one label can't be told apart with a screen reader. + ## Pull Requests - Pull requests should update `CHANGELOG.md` with a short description of the change. diff --git a/CHANGELOG.md b/CHANGELOG.md index 44c7ef6b..6df361ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ - _...Add new stuff here..._ ### 🐞 Bug fixes +- Add distinct screen reader labels for the anchor, X offset, and Y offset in each variable anchor offset row. - Open `icon-padding` expressions in the expression editor so they can be viewed and edited. - Fix `icon-padding` showing four inputs and only saving once all four were filled; it now uses the same add/remove list as other number arrays, up to four values - Make small sprites easier to recognize in the sprite picker with fixed-size previews and high-resolution sprite assets diff --git a/e2e/layers-list.spec.ts b/e2e/layers-list.spec.ts index 21d77f69..6ff3528e 100644 --- a/e2e/layers-list.spec.ts +++ b/e2e/layers-list.spec.ts @@ -260,6 +260,14 @@ describe("layers list", () => { }); }); + test("should identify each anchor and offset by row and axis", async () => { + await when.addValueToPropertyArray("spec-field:text-variable-anchor-offset", "8"); + + await then(get.element("[data-wd-key='spec-field:text-variable-anchor-offset'] select[aria-label$='row 1 anchor']")).shouldBeVisible(); + await then(get.element("[data-wd-key='spec-field:text-variable-anchor-offset'] input[aria-label$='row 2 X offset']")).shouldHaveValue("0"); + await then(get.element("[data-wd-key='spec-field:text-variable-anchor-offset'] input[aria-label$='row 2 Y offset']")).shouldHaveValue("8"); + }); + test("should remove an anchor row", async () => { // the row's delete button shares the function stop's class await when.deleteFunctionStop("text-variable-anchor-offset"); diff --git a/src/components/InputVariableAnchorOffsetCollection.tsx b/src/components/InputVariableAnchorOffsetCollection.tsx index c79068bf..e792fc94 100644 --- a/src/components/InputVariableAnchorOffsetCollection.tsx +++ b/src/components/InputVariableAnchorOffsetCollection.tsx @@ -58,6 +58,7 @@ class InputVariableAnchorOffsetCollectionInternal extends React.Component
this.deleteValue(i)} {...i18nProps} /> @@ -68,17 +69,17 @@ class InputVariableAnchorOffsetCollectionInternal extends React.Component this.changeAnchor(i, v as string)} - aria-label={label} + aria-label={t("{{label}} row {{row}} anchor", { label, row })} /> this.changeOffset(i, 0, v)} - aria-label={label} + aria-label={t("{{label}} row {{row}} X offset", { label, row })} /> this.changeOffset(i, 1, v)} - aria-label={label} + aria-label={t("{{label}} row {{row}} Y offset", { label, row })} />