Skip to content

Expose SVG drawings to assistive technology; implement TextArea trim - #1327

Merged
mstijak merged 4 commits into
masterfrom
feat/svg-aria-role-label
Sep 9, 2026
Merged

Expose SVG drawings to assistive technology; implement TextArea trim#1327
mstijak merged 4 commits into
masterfrom
feat/svg-aria-role-label

Conversation

@mstijak

@mstijak mstijak commented Sep 9, 2026

Copy link
Copy Markdown
Member

Three accessibility changes to how SVG drawings are exposed, plus a TextArea fix found on the way.

Svg: role and ariaLabel

An svg with no accessible name is announced shape by shape, and browsers exporting tagged PDF give every primitive its own structure element — a chart arrives as dozens of anonymous figures rather than one described graphic.

role defaults to img when ariaLabel is set. A name without a role is unreliable on a bare svg, and a role without a name is worse than neither: it hides whatever text the drawing contains and puts nothing in its place. Both default to undefined, so nothing changes for existing users.

Legend: unnamed entry shapes are hidden

A legend shape is a colour key whose meaning is already carried by the entry text beside it, so it now carries aria-hidden rather than being announced as an unnamed graphic. This one is a behaviour change for existing consumers — worth a line in the release notes.

shapeRole and shapeAriaLabel forward onto each shape's svg for callers that need it exposed instead, deriving role the same way Svg does. The two are mutually exclusive by construction: aria-hidden removes the element from the accessibility tree, which is also what a tagged PDF is built from, so a named shape must not carry it.

TextArea: trim implemented rather than omitted

trim was excluded from TextAreaConfig and forced to false, so a textarea silently ignored it and a global TextField.prototype.trim never applied to one.

It applies to the commit that ends the edit, not to intermediate input commits: trimming on every keystroke would strip whitespace the user is still typing, and in a multi-line field a trailing newline could never be entered at all. Whitespace inside the text is untouched, and the visible text is synced so the field and the store agree.

An svg with no accessible name is announced shape by shape, and browsers
exporting tagged PDF give every primitive its own structure element, so a
chart arrives as dozens of anonymous figures instead of one described
graphic.

role defaults to img when ariaLabel is set. A name without a role is
unreliable on a bare svg, and a role without a name is worse than neither:
it hides whatever text the drawing contains and puts nothing in its place.
Both default to undefined, so nothing changes for existing users.
A legend shape is a colour key whose meaning is already carried by the entry
text beside it, so it is now hidden from assistive technology rather than
announced as an unnamed graphic.

shapeRole and shapeAriaLabel forward onto each shape's svg for callers that
need it exposed, deriving role the same way Svg does. The two are mutually
exclusive by construction: aria-hidden removes the element from the
accessibility tree, which is also what a tagged PDF is built from, so a named
shape must not carry it.
trim was excluded from TextAreaConfig and forced to false, so a textarea
silently ignored it and a global TextField.prototype.trim never applied.

It is applied to the commit that ends the edit rather than to intermediate
input commits: trimming on every keystroke would strip whitespace the user is
still typing, and in a multi-line field a trailing newline could never be
entered at all. Whitespace inside the text is untouched; the visible text is
synced so the field and the store agree.
@mstijak
mstijak merged commit 1ec057b into master Sep 9, 2026
2 checks passed
@mstijak
mstijak deleted the feat/svg-aria-role-label branch September 9, 2026 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant