Skip to content

feat: use custom aria labels for inputs with move announcements#9846

Open
mikeharv wants to merge 1 commit intoRaspberryPiFoundation:v13from
mikeharv:custom-input-moves
Open

feat: use custom aria labels for inputs with move announcements#9846
mikeharv wants to merge 1 commit intoRaspberryPiFoundation:v13from
mikeharv:custom-input-moves

Conversation

@mikeharv
Copy link
Copy Markdown
Contributor

@mikeharv mikeharv commented May 8, 2026

The basics

The details

Resolves

Fixes #9836

Proposed Changes

This PR allows move announcements to use Input.ariaLabelProvider when disambiguating connection candidates.

image

If a provider is not provided, or one returns an empty string, we will fallback on the computed label using either the field labels for the input, or, if it's a statement input, a subset of inputs.

image

Test Coverage

A new test ensures that a move announcement disambiguates with custom input labels.

I also updated a few related tests to assert using string literals rather than duplicate computation logic that lived in the test file. This should make the tests easier to read and more likely to catch accidental regressions.

@mikeharv mikeharv requested a review from a team as a code owner May 8, 2026 16:26
@mikeharv mikeharv requested a review from gonfunko May 8, 2026 16:26
@github-actions github-actions Bot added the PR: feature Adds a feature label May 8, 2026
@mikeharv mikeharv requested a review from lizschwab May 8, 2026 16:27
? input.getAriaLabelText()!
: input.getLabel(verbosity),
);
.map((input) => input.getAriaLabelText() ?? input.getLabel(verbosity));
Copy link
Copy Markdown
Contributor Author

@mikeharv mikeharv May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't change anything functionally, but using nullish is safe because it expresses the intended “use this unless it's null” logic directly, while avoiding both a duplicate method call and an unnecessary non-null assertion.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I was under the impression that nullish coalescing was unsafe here because empty string evaluates to falsy but looks like the MDN documentation says that's not the case. Thanks, I wanted to do that to begin with. :D

Copy link
Copy Markdown
Contributor

@lizschwab lizschwab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

? input.getAriaLabelText()!
: input.getLabel(verbosity),
);
.map((input) => input.getAriaLabelText() ?? input.getLabel(verbosity));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, I was under the impression that nullish coalescing was unsafe here because empty string evaluates to falsy but looks like the MDN documentation says that's not the case. Thanks, I wanted to do that to begin with. :D

@mikeharv mikeharv enabled auto-merge (squash) May 8, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: feature Adds a feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants