-
Notifications
You must be signed in to change notification settings - Fork 3.8k
fix: create more comprehensive field row labels #9458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: add-screen-reader-support-experimental
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -324,9 +324,17 @@ export class Input { | |
| if (!fieldRowLabel) { | ||
| const inputs = this.getSourceBlock().inputList; | ||
| const index = inputs.indexOf(this); | ||
| if (index > 0) { | ||
| return inputs[index - 1].getFieldRowLabel(); | ||
| } | ||
| const precedingInputs = inputs.slice(0, index); | ||
| return precedingInputs | ||
| .flatMap((input) => { | ||
| const fields = input.fieldRow.map((field) => { | ||
| if (!field.isVisible()) return undefined; | ||
| return [field.getText() ?? field.getValue()]; | ||
| }); | ||
| return fields; | ||
| }) | ||
| .filter(Boolean) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've actually never seen this syntax 'hack'. Is it effectively the same as
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, this is exactly what it does in terms of API and in practice. |
||
| .join(' '); | ||
| } | ||
| return fieldRowLabel; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems necessary to keep (at least,
slicewill probably misbehave without this check). That being said, I'm not sure it's even possible for this scenario to logically happen in practice, but it's definitely possible just from an API perspective.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[1, 2, 3].slice(0, 0)returns[], so this should do no harm, but I'm happy to keep the check in.