Skip to content
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

fix: Fix accessibility issues #3095

Merged
merged 1 commit into from
Mar 31, 2020
Merged

Conversation

bryceosterhaus
Copy link
Member

Hey @kresimir-coko, here are some changes I made on top of your PR. Check out my PR comments for explanations of changes

Copy link
Member Author

@bryceosterhaus bryceosterhaus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if these changes make sense to you, @kresimir-coko

*/
disabled?: boolean;
dropDownTriggerProps?: React.HTMLAttributes<HTMLButtonElement>;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than have just aria labels available to the trigger element, I thought it would be better to provide a more robust API to allow more customization on that element. This allows them to add other accessibility attrs as needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, you went a step further and added props for those triggers, nice!

@@ -56,8 +56,8 @@ interface IProps extends React.HTMLAttributes<HTMLDivElement> {
* Labels for the aria attributes
*/
ariaLabels?: {
transferButtonLTR: string;
transferButtonRTL: string;
transferLTR: string;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For all ariaLabel props, I think we should focus less on the element itself and more on the language the user wants to use. So by removing Button from the name, it's more clear that this prop is for a language map.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea the naming was a bit tricky to decide on

@@ -164,9 +156,9 @@ const ClaySelectBox: React.FunctionComponent<IProps> = ({
);

return (
<div {...otherProps} className={classNames(className, 'form-group')}>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is called a Select component, I would expect the ...otherProps to apply to the select element and not the container. If we need the ability to add props to the container, we can use containerProps. This is really only for the case when the component name is not consistent with the container element.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, good to know! Makes sense now that you put it like that but I kinda forgot about containerProps

@kresimir-coko
Copy link
Member

@bryceosterhaus all makes sense, the naming I was unsure of, as well as the {...otherProps} part in the select component, but yea your changes look great!

@coveralls
Copy link

coveralls commented Mar 31, 2020

Pull Request Test Coverage Report for Build 4674

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.03%) to 78.358%

Totals Coverage Status
Change from base Build 4668: 0.03%
Covered Lines: 2274
Relevant Lines: 2701

💛 - Coveralls

@bryceosterhaus bryceosterhaus marked this pull request as ready for review March 31, 2020 18:33
@bryceosterhaus bryceosterhaus changed the title fix(@clayui/time-picker): aria-labels prop shouldn't be concerned with the element type. fix: Fix accessibility issues Mar 31, 2020
@bryceosterhaus
Copy link
Member Author

I squashed everything into one commit for the sake of versioning. Just need to add some updated docs for this

@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 31, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5e09db0:

Sandbox Source
competent-http-ce2pd Configuration
reverent-khorana-msdi6 Configuration

@bryceosterhaus bryceosterhaus merged commit 887c09b into liferay:master Mar 31, 2020
@kresimir-coko kresimir-coko linked an issue Apr 15, 2020 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minor accessibility a11y violation on InputWithMultiSelect
3 participants