Skip to content

Commit

Permalink
fix(composer): add aria labels to rules panel
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonvogt committed Sep 29, 2023
1 parent f793a45 commit ff78ab0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/scene-composer/src/components/panels/SceneRulesPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,24 @@ export const SceneRuleMapExpandableInfoSection: React.FC<
if (newRule) {
items.push(newRule);
}
//TODO: When we migrate from polaris to cloudscape, just pass these as normal props to AttributeEditor
const a11yProps = {
i18nStrings: {
itemRemovedAriaLive: intl.formatMessage({
defaultMessage: 'Removed statement',
description: 'Aria live announcement for when a statement is removed',
}),
},
removeButtonAriaLabel: (statement: IRuleStatementInternal) =>
`${intl.formatMessage({
defaultMessage: 'Remove statement',
description: 'Aria label for remove statement button',
})} ${statement.expression}`,
};
return (
<ExpandableInfoSection title={ruleBasedMapId} defaultExpanded={false}>
<AttributeEditor
{...a11yProps}
onAddButtonClick={() => setNewRule({ expression: '', target: '' })}
onRemoveButtonClick={({ detail: { itemIndex } }) => onRemoveRule(itemIndex)}
items={items}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ exports[`SceneRulesPanel returns expected elements. SceneRulesPanel returns expe
data-mocked="AttributeEditor"
definition="[{\\"label\\":\\"Expression\\"},{\\"label\\":\\"Target\\"}]"
empty="No statements"
i18nstrings="{\\"itemRemovedAriaLive\\":\\"Removed statement\\"}"
items="[{\\"expression\\":\\"exp1\\",\\"target\\":\\"target1\\"},\\"mapId\\"]"
removebuttontext="Remove statement"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,10 @@
"note": "Menu Item",
"text": "Pointer Lock"
},
"J+haL1": {
"note": "Aria live announcement for when a statement is removed",
"text": "Removed statement"
},
"JTUN+G": {
"note": "Form field label",
"text": "Focal length"
Expand Down Expand Up @@ -539,6 +543,10 @@
"note": "Expandable Section title",
"text": "Tag"
},
"RZeAOs": {
"note": "Aria label for remove statement button",
"text": "Remove statement"
},
"SYAG+q": {
"note": "Form Field label",
"text": "Environment Preset"
Expand Down

0 comments on commit ff78ab0

Please sign in to comment.