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(Dropdown): accessibility problem (screen readers) #1836

Merged
merged 5 commits into from
Jul 16, 2017

Conversation

Sole-Valero
Copy link
Contributor

@Sole-Valero Sole-Valero commented Jul 5, 2017

Fixes #1834
Screen readers read aloud the different options.

@codecov-io
Copy link

codecov-io commented Jul 5, 2017

Codecov Report

Merging #1836 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1836   +/-   ##
=======================================
  Coverage   99.75%   99.75%           
=======================================
  Files         144      144           
  Lines        2463     2463           
=======================================
  Hits         2457     2457           
  Misses          6        6
Impacted Files Coverage Δ
src/modules/Dropdown/Dropdown.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c194992...60130c6. Read the comment docs.

@layershifter layershifter changed the title fix(Dropdown): accessibility problem (screen readers)(#1834) fix(Dropdown): accessibility problem (screen readers) Jul 5, 2017
} else {
finalRenderedText = <div className={classes}>{_text}</div>
}
return finalRenderedText
Copy link
Member

Choose a reason for hiding this comment

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

I think that we can make it simplier:

if (classes === 'text') return <div className={classes} role='alert' aria-live='polite'>{_text}</div>
return <div className={classes}>{_text}</div

Copy link
Contributor Author

@Sole-Valero Sole-Valero Jul 7, 2017

Choose a reason for hiding this comment

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

Done

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ups...I had a mistake...I'll patch it


return <div className={classes}>{_text}</div>
let finalRenderedText = null
if (classes === 'text') {
Copy link
Member

Choose a reason for hiding this comment

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

Can you clarify why we don't add aria attributes in other cases?

Copy link
Contributor Author

@Sole-Valero Sole-Valero Jul 7, 2017

Choose a reason for hiding this comment

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

I don't add them because I don't know when are used the other cases. If you can explain me them, I can notice if they are needed or not, and also, which ones. If I know in which examples from the documentation they are rendered...I can try also to improve them.

Copy link
Contributor Author

@Sole-Valero Sole-Valero Jul 12, 2017

Choose a reason for hiding this comment

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

I updated the code. Now returns always the rendered text with the aria-labels suggested. I tested the documentation page, and all dropdown added work as in the main documentation page (http://react.semantic-ui.com)


if (classes === 'text') {
return <div className={classes} role='alert' aria-live='polite'>{_text}</div>
}
Copy link
Member

Choose a reason for hiding this comment

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

I believe classes === 'text' is the same as the final return case here. When none of the above conditions match, the text is rendered as:

<div class="text">File</div>

Is there a reason not to add role='alert' aria-live='polite' to the final return value instead?

Copy link
Contributor Author

@Sole-Valero Sole-Valero Jul 10, 2017

Choose a reason for hiding this comment

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

@levithomason we only need to mark as 'alert' a DIV which text changes and the user should know about the update. In the dropdowns case, the DIV which displays the value selected by the user uses the class 'Text'.
To the best of my knowledge, renderText returns a div which can be marked with classes: text , default and filtered. Looking at the examples of the documentation, I noticed than 'text' is always used to the DIV which contains the value selected, but I don't know when the other two options are used. Can you give me examples of them to decide if we need to add the alert tag in the three cases?

Copy link
Contributor Author

@Sole-Valero Sole-Valero Jul 12, 2017

Choose a reason for hiding this comment

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

I updated the code. Now returns always the rendered text with the aria-labels suggested. I tested the documentation page, and all dropdown added work as in the main documentation page (http://react.semantic-ui.com)

        - Dropdown.js->renderTex--> now always returns the text rendered with aria labels: role='alert' aria-live='polite'
Copy link
Contributor Author

@Sole-Valero Sole-Valero left a comment

Choose a reason for hiding this comment

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

Now, it always renders the text with the aria labels: role=alert aria-live='polite'

Copy link
Contributor Author

@Sole-Valero Sole-Valero left a comment

Choose a reason for hiding this comment

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

thanks, my editor doen't mark that lint error..sorry

@levithomason
Copy link
Member

@Sole-Valero

text Shows the active value, though, this may change in the future to the selected (highlighted value in the menu) or active value.

filtered Used to hide the text when a search is in progress.

default Used for placeholder text.

Let's merge this as is for now and update should we hit any future issues. Thanks for the work and thoughtfulness here!

@levithomason levithomason merged commit 931fe37 into Semantic-Org:master Jul 16, 2017
@levithomason
Copy link
Member

Released in semantic-ui-react@0.71.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants