-
Notifications
You must be signed in to change notification settings - Fork 85
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
feat(step-flow): add aria props to component - FE-7013 #7121
base: master
Are you sure you want to change the base?
Conversation
@@ -180,7 +195,14 @@ export const StepFlow = forwardRef<StepFlowHandle, StepFlowProps>( | |||
); | |||
|
|||
return ( | |||
<StyledStepFlow {...rest} {...tagComponent("step-flow", rest)}> | |||
<StyledStepFlow | |||
role="group" |
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 role has been added because I saw an Axe warning of attribute is not well supported on a div with no valid role attribute
when using the aria props. The role of group
was what I thought fit this component. However, I am open to suggestions on which is best. A role of presentation
or none
triggers the Axe warning.
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.
Looks good to me, just a couple non-blocking suggestions
|
||
const stepFlowComponent = screen.getByTestId("step-flow"); | ||
|
||
expect(stepFlowComponent).toHaveAttribute("aria-label", "foo"); |
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.
suggestion (non-blocking): We could use the toHaveAccessbleName
matcher here to ensure the accessible name has been correctly set.
expect(stepFlowComponent).toHaveAttribute("aria-label", "foo"); | |
expect(stepFlowComponent).toHaveAccessibleName( "foo"); |
|
||
const stepFlowComponent = screen.getByTestId("step-flow"); | ||
|
||
expect(stepFlowComponent).toHaveAttribute("aria-labelledby", "foo"); |
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.
suggestion (non-blocking): Same here
|
||
const stepFlowComponent = screen.getByTestId("step-flow"); | ||
|
||
expect(stepFlowComponent).toHaveAttribute("aria-describedby", "foo"); |
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.
Suggestion (non-blocking): Same here, we could use toHaveAccessibleDescription
Proposed behaviour
Aria props are destructured and present in the documentation for
Step Flow
Current behaviour
Aria props are not destructured. They are present due to
...rest
being spread on the component. Due to this, they do not appear in the Storybook documentation for the component under theProps
section.Checklist
d.ts
file added or updated if requiredQA
Additional context
N/A
Testing instructions
New test stories have been created to demonstrate the newly added aria props. These stories are:
You should be able to see these attributes in the DOM, on the element for Step Flow.
There should also be no other functional or styling regressions due to this change.