fix: improve block labels and aria roles#9834
Conversation
|
Updated to account for the merge conflict with showing custom input labels in move mode. Required adding a new parameter to control if the custom labels should be used or not. Also updated the move announcement tests to be a little bit less flaky. I did remove one assert because I think it's correct that the announcement is "moving inside custom else if input of if do else if do" but let me know if you think that's not correct |
mikeharv
left a comment
There was a problem hiding this comment.
Thanks for shoring up the tests. My suggestion isn't blocking, but I noticed we might be calling getAriaLabelText() when we don't always need to.
| const customLabel = input.getAriaLabelText(); | ||
| return useCustomLabels && customLabel !== null | ||
| ? customLabel | ||
| : input.getLabel(verbosity); |
There was a problem hiding this comment.
Nit: This could also be
const customLabel = useCustomLabels
? input.getAriaLabelText()
: null;
return customLabel ?? input.getLabel(verbosity);
This could be worthwhile just because we don't know how heavy a label provider function might be and it saves us having to execute it if not needed.
The basics
The details
Resolves
Fixes #9802
Fixes #9804
Partially addresses #9793 (actually does fix it technically but making a follow up change related)
Fixes #9790
Fixes RaspberryPiFoundation/blockly-keyboard-experimentation#789
Proposed Changes
getFullBlockFieldmethod to facilitate checking this. this is different than what's in the design doc for reasons i put in a comment in the design doc.isSimpleReportermethod to better explain what that means.fieldclass and had subclasses override it where needed to set customized labels and other states.Reason for Changes
Makes aria markup better
Test Coverage
Fixed the tests, removed some that assert behavior we don't actually want.
I skipped some tests related to custom input labels because I'm about to implement the custom input labels in a separate PR and I'll unskip them then.
Documentation
maybe for setting aria for custom fields, but it depends how we write the documentation.
Additional Information