Skip to content

fix(a11y): settings toggles - #49664

Merged
ahmaxed merged 16 commits into
freeCodeCamp:mainfrom
bbsmooth:fix/settings-toggles
Apr 12, 2023
Merged

ahmaxed merged 16 commits into
freeCodeCamp:mainfrom
bbsmooth:fix/settings-toggles

Conversation

@bbsmooth

@bbsmooth bbsmooth commented Mar 10, 2023 •

Copy link
Copy Markdown
Contributor

Checklist:

Closes #49214

Sorry @Sboonny, I didn't realize you were working on this as well.

I just went with the browser's default radio buttons. Not sure if we want to use customized buttons?

@bbsmooth bbsmooth added scope: a11y Threads for addressing accessibility issues. scope: UI Threads for addressing UX changes and improvements to user interface platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. labels Mar 10, 2023
@bbsmooth
bbsmooth requested a review from a team March 10, 2023 19:05
@bbsmooth
bbsmooth marked this pull request as draft March 10, 2023 19:05
@ghost

ghost commented Mar 10, 2023 •

Copy link
Copy Markdown

👀 Review this PR in a CodeSee Review Map

View the CodeSee Map of this change

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@Sboonny

Sboonny commented Mar 10, 2023 •

Copy link
Copy Markdown
Member

Sorry @Sboonny, I didn't realize you were working on this as well.

Didn't do much, to be honest. and I am always happy with the help, ping me if you want me to pick up a task.

@Sboonny Sboonny mentioned this pull request Mar 10, 2023
4 tasks done
@bbsmooth

Copy link
Copy Markdown
Contributor Author

@Sboonny What I really need to know is how we want to style the radio buttons. That's the main blocker.

@Sboonny

Sboonny commented Mar 11, 2023

Copy link
Copy Markdown
Member

I don't mind the current look, but I will bring this to the Wednesday meeting, if needed 👍

@github-actions github-actions Bot added the scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. label Mar 11, 2023
@ahmaxed

ahmaxed commented Mar 15, 2023

Copy link
Copy Markdown
Member

We could go with something like this for the styles:
Screenshot 2023-03-15 at 12 23 34 PM

Also the tick for the toggle could come back if it does not have any accessibility issues.

@bbsmooth

Copy link
Copy Markdown
Contributor Author

@ahmadabdolsaheb I would be hesitant to use square boxes here since they are usually associated with check boxes, not radio buttons.

@bbsmooth
bbsmooth marked this pull request as ready for review March 16, 2023 19:51
@bbsmooth
bbsmooth force-pushed the fix/settings-toggles branch from cf7c125 to e75eeb8 Compare March 16, 2023 21:04
@Sboonny

This comment was marked as resolved.

@bbsmooth

Copy link
Copy Markdown
Contributor Author

do we need aria-labelledby?

You'll notice that aria-labelledby is only used when the toggle has extra description text. In that case, we use aria-labelledby to change the accessible name to include both the toggle name and the description text so that screen readers will announce both when the user is interacting with the toggle. This is a standard best practice pattern.

@ahmaxed

ahmaxed commented Mar 20, 2023 •

Copy link
Copy Markdown
Member

@ahmadabdolsaheb I would be hesitant to use square boxes here since they are usually associated with check boxes, not radio buttons.

Sure, we could go with round ones.

@Sboonny Sboonny mentioned this pull request Mar 20, 2023
4 tasks done
@raisedadead raisedadead added the status: waiting update Is awaiting update, after feedback or request for changes label Mar 21, 2023

@Sboonny Sboonny left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Btw, you are right in this #49664 (comment), if you want to revert the lastest commit, please do so.


My suggestion was based on lack of knowledge, which you have provided. this is good to go after fixing the conflicts 👍.

@Sboonny

Sboonny commented Mar 30, 2023 •

Copy link
Copy Markdown
Member

@bbsmooth, Is it okay if I push a commit that sort RTL, and fix the conflict? I will try to remove position and use grid instead of useEffect, similar to the changes in system theme #48757.

@bbsmooth

Copy link
Copy Markdown
Contributor Author

@Sboonny Yes, go ahead.

chore: remove unnecessary elements

remove unnecessary CSS/fix responsiveness

feat: add keyboard focus for radio buttons

fix: use defaultChecked and onChange for radio buttons

fix: do not change color on hover over pressed button

fix: focus outline should show on all four sides of button

chore: setPrivacyTogglesToPublic

feat: add tick mark to active button

refactor: remove unnecessary ternary

fix: focused button should not stack on top of flash alert

feat: standardize radio button color

fix: remove random id generation
@Sboonny
Sboonny force-pushed the fix/settings-toggles branch from a5f3c39 to 0c5047e Compare March 30, 2023 16:25
@Sboonny Sboonny added status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. and removed status: waiting update Is awaiting update, after feedback or request for changes labels Mar 30, 2023
@bbsmooth

Copy link
Copy Markdown
Contributor Author

@Sboonny, are you done with your RTL updates? Everything looks pretty good, there are just a few minor things I'd like to adjust, but I want to wait until you are done.

@Sboonny

Sboonny commented Mar 31, 2023

Copy link
Copy Markdown
Member

Yeab, please go ahead. 👍

@bbsmooth
bbsmooth requested a review from Sboonny April 3, 2023 05:18
@bbsmooth

bbsmooth commented Apr 3, 2023 •

Copy link
Copy Markdown
Contributor Author

@Sboonny I updated the styling on the buttons so that the text is always centered and the check mark will be positioned just to the outside of the text. I also added a slight gap between the buttons so that the outline focus indicator would show on all four sides of both buttons. But if you would rather not have that 3px gap then we can add a background color to the .toggle-button-group wrapper div to fill that space. Or, we could remove the 3px gap and then use relative positioning and z-index on the button when focused to make sure that it stacks above the other button so that all four sides of the outline show.

The radio buttons still look the same but I switched their various margins to logical properties so they would look the same in rtl languages.

@Sboonny

Sboonny commented Apr 3, 2023

Copy link
Copy Markdown
Member

But if you would rather not have that 3px gap then we can add a background color to the .toggle-button-group wrapper div to fill that space. Or, we could remove the 3px gap and then use relative positioning and z-index on the button when focused to make sure that it stacks above the other button so that all four sides of the outline show.

No need, Idk what the others think, but I am happy with the current looks 👍.

@bbsmooth bbsmooth added status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. and removed status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. labels Apr 4, 2023
@ahmaxed

ahmaxed commented Apr 4, 2023

Copy link
Copy Markdown
Member

Thank you for the hard work here.
The difference between the inputs are harder to distinguish in dark mode than it is in Light mode.

Screenshot 2023-04-04 at 2 22 13 PM

Would it be possible to set the border of the unselected input to the secondary-color and the background to transparent or the secondary-background?

@bbsmooth

bbsmooth commented Apr 5, 2023 •

Copy link
Copy Markdown
Contributor Author

@ahmadabdolsaheb I agree, in dark mode it is hard to tell the difference between the selected and non-selected radio button. Browsers don't provide a lot of options for styling native radio buttons. I will see if I can somehow make the difference between the two states larger using only CSS but I fear we may need to switch to some sort of custom solution. That won't be too difficult though.

@raisedadead raisedadead added status: waiting update Is awaiting update, after feedback or request for changes and removed status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. labels Apr 6, 2023
@bbsmooth bbsmooth added status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. and removed status: waiting update Is awaiting update, after feedback or request for changes labels Apr 8, 2023
@bbsmooth
bbsmooth requested a review from ahmaxed April 8, 2023 04:55
@bbsmooth

bbsmooth commented Apr 8, 2023

Copy link
Copy Markdown
Contributor Author

@ahmadabdolsaheb Custom radio button styling added. Should be very clear now both in light and dark mode.

@ahmaxed ahmaxed left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the hard here. I want to get this in asap, but there are a few changes that improve the toggle buttons in another pr:

  • toggle-button.tsx in the helper folder could be removed since it is not used anywhere.
  • checkIconStyle should be moved to a CSS file.
  • we have toggle buttons in video courses (scientific-computing-with-python, etc.), the newly added toggles should replicate the style of the pre-exiting toggles for consistency.

@ahmaxed
ahmaxed merged commit e0088db into freeCodeCamp:main Apr 12, 2023
@bbsmooth
bbsmooth deleted the fix/settings-toggles branch April 24, 2023 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. scope: a11y Threads for addressing accessibility issues. scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. scope: UI Threads for addressing UX changes and improvements to user interface status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Toggle buttons on Settings page are not accessible

4 participants