You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
platform: learnUI side of the client application that needs familiarity with React, Gatsby etc.scope: a11yThreads for addressing accessibility issues.status: discussingUnder discussion threads. Closed as stale after 60 days of inactivity.
The language picker in the main menu in the curriculum is currently inaccessible to keyboard only users because the change is triggered as soon as you press the down arrow key (which triggers a change event causing the language to be changed immediately). There really is no good way to use a <select> here if you want the change to be triggered without clicking a separate button to initiate the change (this just isn't how selects were intended to operate). You basically have to implement an alternative solution that is accessible to keyboard users.
I have spent the past few days creating an alternative, accessible solution, and am just about ready to submit the PR, but before I do that I can't help thinking that this might be over-complicating the issue and there is a better way. I'd like to suggest that we move the language picker to the user's settings page. If we did that then we could have a button that initiates the change and then we could use a plain old <select> which would reduce the complexity of implementing this functionality considerably. We could still include the language picker in the main menu, but it would just be a link that takes the user to their settings page.
OK, I just discovered that you can actually use the keyboard to force the select list to show all of the options and then arrow to the option you want and hit 'Enter' to select it. (On my computer usng FF it is `Alt+DownArrow). So there is in fact a way to make the language select work as it is now and thus it is technically not inaccessible to keyboard only users.
I think I would still argue that this workaround may not be known to all keyboard users, so having this option on the settings page instead would allow us to make it a little easier for keyboard users to use. Especially because I think the first instinct would be to hit the down arrow and thus they will be changed to Spanish immediately before they figure out that they need to use a special keyboard combination to expand the select. But if we are happy with keeping it on the main menu for now then we are technically good to go for accessibility and all the fun I had implementing a custom language picker was for naught.
Sorry for all the updates, I'm still learning some of this accessibility stuff.
After further investigation, I think the current language picker implementation is actually not technically accessible even though the user can use the "Alt+Arrow" combination to expand the select and choose a language. According to WCAG 3.2.2 On Input:
"Changing the setting of any user interface component does not automatically cause a change of context unless the user has been advised of the behavior before using the component."
The "change of context" in this case is changing to a new language. Since we aren't warning the user that the mere act of selecting a language in the select will automatically cause the page to refresh in that language then we are in violation of 3.2.2. Adding a button that says "update language" would remediate this issue because the button is telling the user what will happen as a result of clicking it. The other option here would be to add visible text that tells the user that selecting a language will change the language of the page immediately, which I don't think would fit nicely in the menu.
So I guess I am reinstating by original suggestion that we move the language picker to the settings page and have a link to it in the main menu.
@bbsmooth Thanks for opening the issue, and no need to apologize. I love reading these analyses and I actually have learned a ton from your opened issues and PRs (case in point: this a11y requirement).
Accessibility aspect aside, I think language is not something the user would need to change often, so moving the picker to the Setting page would allow us to preserve some space in the dropdown menu. The Account Settings section seems to be the most appropriate place to add the picker, but @ahmadabdolsaheb is the best person for UI/UX recommendation.
Additionally, we should add the lang attribute to the options to help screen readers announce them properly (I just tested with VoiceOver and it is struggling with Chinese, Ukrainian, and Japanese).
Thanks, for taking the time to debug/research this.
To Stress: Some of the main features of the freeCodeCamp community are:
a) The ability to go through the curriculum without an account
b) The wonderful effort that has gone into making the content accessibility in other languages
So, we have the language setting there, because we want non-signed in Campers (no access to a /settings page) to be able to access the language.
if you want the change to be triggered without clicking a separate button to initiate the change
Personally, I dislike this current behaviour.
My suggestion
The dropdown could appear as though navigating with a mouse, and only upon selection (enter), does the languages get selected, and the page change location.
Sorry, I was under the impression that the language option only showed up in the main menu if you were signed in. I see now that it is always there (my bad). If I had realized this earlier I wouldn't have suggested we move it to the settings page. Seeing as this needs to stay available even when not logged in then yes, it makes sense to keep it in the main menu.
The dropdown could appear as though navigating with a mouse, and only upon selection (enter), does the languages get selected, and the page change location.
This is exactly what my alternative version does. Basically, you have to roll your own custom selection menu so that the change does not trigger until the user hits the Enter button.
The other option would be to pop up a modal for the language picker, which would allow us to use a simple <select> with a <button> to trigger the change. I'm starting to think this might be the better approach because it would make it clear that the language will change immediately when clicking the button (satisfying WCAG 3.2.2) and we could also rely on default browser positioning when the select is expanded rather than having to position it ourselves when there isn't enough height in the view port.
By default, radio buttons aren't intended to trigger a context change by pressing the Enter when they are focused, so I think that would be a big anti-pattern. On the WAI-ARIA best practices example for radio buttons they don't even define functionality for the Enter key. My alternative uses a custom navigation submenu which does specify that the Enter/Space keys activate the menu item. I'm still not convinced this 100% meets WCAG 3.2.2, but it is definitely more accessible than what we currently have.
Modals get a bad rap because they often aren't implemented properly (i.e. accessibly). I can assure you that mine would be as accessible as possible :-) Does FCC currently use any modals? I don't believe I've run into any yet but maybe I'm not looking in the right place?
Does FCC currently use any modals? I don't believe I've run into any yet but maybe I'm not looking in the right place?
Only every time you complete a challenge/project.
Are we talking about different things, when we talk about modals? I mean the "fake page" that pops up taking focus - I dislike them on a usability standpoint, but also mostly because most that I have encountered are ads.
Ahh, thank you. I don't complete a lot of challenges so this example didn't come to mind. Yes, this is what I am referring to when talking about a modal dialog for the language picker. I do agree that they are often misused and this contributes to their bad rep, but obviously we wouldn't be misusing it here since we would only open it on user interaction. As for usability, I don't see too much of an issue in this case. Dialogs can often enhance accessibility by focusing the user on a specific task and making it much clearer what the intent and results of their actions will be. In this case I think having a button that says "Change Language" (or whatever) is a little clearer than causing the change by interacting with the item directly in the list.
Just to be clear, while I think a modal approach might be a little better I'm perfectly fine with keeping it entirely within the menu and using a custom submenu approach. I will submit my PR soon and you can check out what I've done and then we can go from there.
Thanks @bbsmooth for looking into improving the accessibility of the language picker.
We have placed the language picker in the main navigation to increase awareness for our i18n efforts.
Down the road we will possibly adopt the footer convention with a language dropdown similar to what google has on their Gmail sign up page( I don't think they are using select).
I have come across websites such as airbnb that implement a button and a modal for this feature, but I would prefer a simpler approach if possible.
If we change the "English" in the menu to a button with area "Change Language", it should do the trick?
platform: learnUI side of the client application that needs familiarity with React, Gatsby etc.scope: a11yThreads for addressing accessibility issues.status: discussingUnder discussion threads. Closed as stale after 60 days of inactivity.
Activity
bbsmooth commentedon Feb 13, 2022
OK, I just discovered that you can actually use the keyboard to force the select list to show all of the options and then arrow to the option you want and hit 'Enter' to select it. (On my computer usng FF it is `Alt+DownArrow). So there is in fact a way to make the language select work as it is now and thus it is technically not inaccessible to keyboard only users.
I think I would still argue that this workaround may not be known to all keyboard users, so having this option on the settings page instead would allow us to make it a little easier for keyboard users to use. Especially because I think the first instinct would be to hit the down arrow and thus they will be changed to Spanish immediately before they figure out that they need to use a special keyboard combination to expand the select. But if we are happy with keeping it on the main menu for now then we are technically good to go for accessibility and all the fun I had implementing a custom language picker was for naught.
bbsmooth commentedon Feb 13, 2022
Sorry for all the updates, I'm still learning some of this accessibility stuff.
After further investigation, I think the current language picker implementation is actually not technically accessible even though the user can use the "Alt+Arrow" combination to expand the select and choose a language. According to WCAG 3.2.2 On Input:
"Changing the setting of any user interface component does not automatically cause a change of context unless the user has been advised of the behavior before using the component."
The "change of context" in this case is changing to a new language. Since we aren't warning the user that the mere act of selecting a language in the select will automatically cause the page to refresh in that language then we are in violation of 3.2.2. Adding a button that says "update language" would remediate this issue because the button is telling the user what will happen as a result of clicking it. The other option here would be to add visible text that tells the user that selecting a language will change the language of the page immediately, which I don't think would fit nicely in the menu.
So I guess I am reinstating by original suggestion that we move the language picker to the settings page and have a link to it in the main menu.
[-]Language picker inaccessible to keyboard users[/-][+]Language picker inaccessibility[/+]huyenltnguyen commentedon Feb 13, 2022
@bbsmooth Thanks for opening the issue, and no need to apologize. I love reading these analyses and I actually have learned a ton from your opened issues and PRs (case in point: this a11y requirement).
Accessibility aspect aside, I think language is not something the user would need to change often, so moving the picker to the Setting page would allow us to preserve some space in the dropdown menu. The Account Settings section seems to be the most appropriate place to add the picker, but @ahmadabdolsaheb is the best person for UI/UX recommendation.
Additionally, we should add the
langattribute to the options to help screen readers announce them properly (I just tested with VoiceOver and it is struggling with Chinese, Ukrainian, and Japanese).ShaunSHamilton commentedon Feb 14, 2022
Thanks, for taking the time to debug/research this.
To Stress: Some of the main features of the freeCodeCamp community are:
a) The ability to go through the curriculum without an account
b) The wonderful effort that has gone into making the content accessibility in other languages
So, we have the language setting there, because we want non-signed in Campers (no access to a
/settingspage) to be able to access the language.Personally, I dislike this current behaviour.
My suggestion
The dropdown could appear as though navigating with a mouse, and only upon selection (
enter), does the languages get selected, and the page change location.bbsmooth commentedon Feb 14, 2022
Sorry, I was under the impression that the language option only showed up in the main menu if you were signed in. I see now that it is always there (my bad). If I had realized this earlier I wouldn't have suggested we move it to the settings page. Seeing as this needs to stay available even when not logged in then yes, it makes sense to keep it in the main menu.
This is exactly what my alternative version does. Basically, you have to roll your own custom selection menu so that the change does not trigger until the user hits the Enter button.
The other option would be to pop up a modal for the language picker, which would allow us to use a simple
<select>with a<button>to trigger the change. I'm starting to think this might be the better approach because it would make it clear that the language will change immediately when clicking the button (satisfying WCAG 3.2.2) and we could also rely on default browser positioning when the select is expanded rather than having to position it ourselves when there isn't enough height in the view port.ShaunSHamilton commentedon Feb 14, 2022
@bbsmooth That all sounds fine to me. Except, I know people are buy-n-large anti-modal.
Is it bad practice to just Jerry-rig a group of
input type="radio"for this?bbsmooth commentedon Feb 14, 2022
By default, radio buttons aren't intended to trigger a context change by pressing the Enter when they are focused, so I think that would be a big anti-pattern. On the WAI-ARIA best practices example for radio buttons they don't even define functionality for the Enter key. My alternative uses a custom navigation submenu which does specify that the Enter/Space keys activate the menu item. I'm still not convinced this 100% meets WCAG 3.2.2, but it is definitely more accessible than what we currently have.
Modals get a bad rap because they often aren't implemented properly (i.e. accessibly). I can assure you that mine would be as accessible as possible :-) Does FCC currently use any modals? I don't believe I've run into any yet but maybe I'm not looking in the right place?
ShaunSHamilton commentedon Feb 14, 2022
Only every time you complete a challenge/project.
Are we talking about different things, when we talk about modals? I mean the "fake page" that pops up taking focus - I dislike them on a usability standpoint, but also mostly because most that I have encountered are ads.
bbsmooth commentedon Feb 14, 2022
Ahh, thank you. I don't complete a lot of challenges so this example didn't come to mind. Yes, this is what I am referring to when talking about a modal dialog for the language picker. I do agree that they are often misused and this contributes to their bad rep, but obviously we wouldn't be misusing it here since we would only open it on user interaction. As for usability, I don't see too much of an issue in this case. Dialogs can often enhance accessibility by focusing the user on a specific task and making it much clearer what the intent and results of their actions will be. In this case I think having a button that says "Change Language" (or whatever) is a little clearer than causing the change by interacting with the item directly in the list.
Just to be clear, while I think a modal approach might be a little better I'm perfectly fine with keeping it entirely within the menu and using a custom submenu approach. I will submit my PR soon and you can check out what I've done and then we can go from there.
ahmaxed commentedon Feb 15, 2022
Thanks @bbsmooth for looking into improving the accessibility of the language picker.
We have placed the language picker in the main navigation to increase awareness for our i18n efforts.
Down the road we will possibly adopt the footer convention with a language dropdown similar to what google has on their Gmail sign up page( I don't think they are using select).
I have come across websites such as airbnb that implement a button and a modal for this feature, but I would prefer a simpler approach if possible.
If we change the "English" in the menu to a button with area "Change Language", it should do the trick?
bbsmooth commentedon Feb 16, 2022
You are reading my mind. That's exactly what I did (before I even read this).