-
Notifications
You must be signed in to change notification settings - Fork 4
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
Improves accessibility of single and multi choice #156
Improves accessibility of single and multi choice #156
Conversation
…ub.com:mavenlink/design-system into webinf-accessible-fixes-single-multi-173478278 # Conflicts: # src/components/custom-field-input-text/custom-field-input-text.jsx
src/components/custom-field-input-single-choice/custom-field-input-single-choice.test.jsx
Outdated
Show resolved
Hide resolved
src/components/custom-field-input-single-choice/custom-field-input-single-choice.test.jsx
Outdated
Show resolved
Hide resolved
src/components/__internal__/abstract-custom-field/abstract-custom-field.test.jsx
Outdated
Show resolved
Hide resolved
src/components/__internal__/abstract-custom-field/abstract-custom-field.test.jsx
Show resolved
Hide resolved
src/components/__internal__/abstract-custom-field/abstract-custom-field.test.jsx
Outdated
Show resolved
Hide resolved
src/components/custom-field-input-multiple-choice/custom-field-input-multiple-choice.jsx
Outdated
Show resolved
Hide resolved
src/components/custom-field-input-single-choice/custom-field-input-single-choice.jsx
Show resolved
Hide resolved
}); | ||
|
||
it('uses a hint to alert users of the error message', () => { | ||
render(<FormControl {...requiredProps} error="I am an error message" />); |
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.
I think this prop switched over to errorText
. Is it still error
in FormControl
? If so, we may want to update it as well.
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.
We can make a new story too to avoid having breaking changes in this particular PR (and thus keep the AC for the story focused)
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.
A couple suggestions, but otherwise LGTM
@@ -152,6 +158,8 @@ function CustomFieldInputMultipleChoice(props) { | |||
fill="skip" | |||
name={iconClear.id} | |||
onClick={onChoicesClear} | |||
onEnter={clearChoices} | |||
tabable={true} |
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 like this isn't used anymore
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.
Let's not forget to clean this up
src/components/__internal__/abstract-custom-field/abstract-custom-field.jsx
Outdated
Show resolved
Hide resolved
I can give this another look over once its greened up. |
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 great! I think there are a few things here that could be done for better semantics and clarity, but they're fairly minor (read: non-blocking).
}; | ||
|
||
const clearIcon = () => { | ||
if (!props.readOnly && (value || searchValue)) { | ||
return (<Icon | ||
name={iconClear.id} | ||
onClick={clear} | ||
onEnter={clear} | ||
ariaLabel={'Remove selected choice'} |
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.
Should this say
ariaLabel={'Remove selected choice'} | |
ariaLabel={'Clear selected choice'} |
To keep the nomenclature consistent?
expect(screen.getByLabelText('Test label', { selector: 'input' })).toHaveValue('some test text'); | ||
userEvent.click(screen.getAllByRole('img')[0]); | ||
expect(screen.getByLabelText('Test label', { selector: 'input' })).toHaveValue(''); | ||
it('clears a value when enter is pressed on the clear icon and the clear icon can be focused for accessibility', () => { |
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.
Do we also want an expectation about where the focus moves after clear is pressed?
role: 'img', | ||
size: 'medium', | ||
stroke: 'none', | ||
title: undefined, | ||
active: true, |
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 should probably be false, so multiple icons on the same page aren't all active.
src/components/icon/icon.jsx
Outdated
role={props.role} | ||
> | ||
{ props.title && <title>{props.title}</title> } | ||
<use onKeyDown={onKeyDown} xlinkHref={`#${props.name}`} /> |
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.
Perhaps we should only attach the onKeyDown
handler if props.role === 'button'
to keep it semantic. If we do make this change, the test should change along with it (and probably a new test should exist to cover the new behavior).
…ub.com:mavenlink/design-system into webinf-accessible-fixes-single-multi-173478278
Motivation
Make things accessible woo! 🥳
https://www.pivotaltracker.com/story/show/173478278
Acceptance Criteria
Single choice bugs
Multi choice bugs
PR upkeep checklist