Skip to content

chore(a11y): standardize keyboard focus - #49579

Merged
Sboonny merged 13 commits into
freeCodeCamp:mainfrom
a2937:focus-indicator-var-color
Mar 24, 2023
Merged

Sboonny merged 13 commits into
freeCodeCamp:mainfrom
a2937:focus-indicator-var-color

Conversation

@a2937

@a2937 a2937 commented Mar 4, 2023 •

Copy link
Copy Markdown
Member

Checklist:

Closes #48121

Same color for both the dark and light color palettes since it is a medium-color. It was actually pretty easier adding the variable to the css variable list and the focus selector to globals.css.

@a2937
a2937 requested a review from a team March 4, 2023 01:02
@github-actions github-actions Bot added the platform: learn UI side of the client application that needs familiarity with React, Gatsby etc. label Mar 4, 2023
@ghost

ghost commented Mar 4, 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

@a2937 a2937 changed the title Chore(cirrculum) - Create a keyboard focus indicator variable Chore(a11y) - Create a keyboard focus indicator variable Mar 4, 2023
@Sembauke Sembauke added the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Mar 6, 2023
@raisedadead raisedadead changed the title Chore(a11y) - Create a keyboard focus indicator variable chore(a11y): add keyboard focus indicator variable Mar 6, 2023
@Sboonny Sboonny changed the title chore(a11y): add keyboard focus indicator variable chore(client): add keyboard focus indicator variable Mar 6, 2023
@Sboonny Sboonny changed the title chore(client): add keyboard focus indicator variable chore(a11y): add keyboard focus indicator variable Mar 6, 2023
@bbsmooth

bbsmooth commented Mar 6, 2023

Copy link
Copy Markdown
Contributor

I am assuming we only want the keyboard focus indicator to show if the user is actually using a keyboard? That's the way I've been implementing the focus indicator as I've been fixing accessibility issues.

If so, then this needs to target the :focus-visible pseudo-class instead of :focus.

:focus-visible has been around long enough in the major browsers/platforms that we probably don't need to worry about a fallback for the minority of browsers that don't support it. But if we do want to be extra careful then we can use @supports to target those browsers.

MDN: focus-visible

@a2937

a2937 commented Mar 6, 2023

Copy link
Copy Markdown
Member Author

My selector being applied

@bbsmooth

bbsmooth commented Mar 6, 2023 •

Copy link
Copy Markdown
Contributor

The way I saw this working would be that we define a default outline color (--blue-mid), outline width (3px), outline style (solid), and outline offset (0) (which would be the same for both themes) on all focusable elements using the :focus-visible pseudo-class. And then we can make the necessary adjustments for specific situations.

I'm guessing that client/src/components/layouts/global.css is where we would want to define the default? @Sboonny, correct me if I'm wrong?

As for the adjustments, I don't think the color will ever need to change (although I could be wrong about this) except for one specific case, the steps grid. Because we are using a blue background to mark completed steps the outline needs to be black in the light theme and white in the dark theme. I think most of the adjustments will need to be made to the offset, and possible width. These adjustments could be different for each theme.

There are a lot of focusable elements, so this PR is potentially going to take a while. @a2937, do you mind if I help out and push changes directly to this PR?

@a2937

a2937 commented Mar 6, 2023

Copy link
Copy Markdown
Member Author

I don't mind the additional assist.

@bbsmooth bbsmooth changed the title chore(a11y): add keyboard focus indicator variable chore(a11y): standardize keyboard focus Mar 6, 2023
@Sboonny

Sboonny commented Mar 7, 2023

Copy link
Copy Markdown
Member

I'm guessing that client/src/components/layouts/global.css is where we would want to define the default? @Sboonny, correct me if I'm wrong?

I am happy with it in the global.css file 👍

@Sboonny Sboonny 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 Mar 9, 2023
@Sboonny

Sboonny commented Mar 20, 2023 •

Copy link
Copy Markdown
Member

What do you mean by overwrite? as change the values in bootstrap file itself? 🤔


I was the one to suggest deleting bootstrap.css #49579 (comment), because:

  • trying to increase the specificity over bootstrap value will create weird ids, that will force terrible developer experience whenever someone interacts with the outline, as it will get in the way whether bootstrap or the new add class.
  • using !important will break the outline in important section like the grid for the challenges in the block map

@a2937
a2937 requested a review from bbsmooth March 20, 2023 18:17
@Sboonny Sboonny added status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. and removed status: blocked In a transient & temporary hold. labels Mar 21, 2023
@ahmaxed

ahmaxed commented Mar 22, 2023

Copy link
Copy Markdown
Member

Thanks for providing more context. The minified files are for consumption only as the styles context such as bootstrap main, normalization, customization, etc. is removed during magnification.

It works for me if you are on board with it. It would be great if you could share your review process for the minified file so I could give it a proper review before merge.

@Sboonny

Sboonny commented Mar 22, 2023 •

Copy link
Copy Markdown
Member

When done correctly, you should see git diff and compare what does the main bootstrap add to the new bootstrap.

image

@bbsmooth

Copy link
Copy Markdown
Contributor

@Sboonny @ahmadabdolsaheb A quick question. Is it the intent to make sure all focus indicators are functioning the way we want them to in this PR? Or is the intent just to get the default in place and then in other PRs we can fix any that still aren't working correctly?

@Sboonny

Sboonny commented Mar 23, 2023 •

Copy link
Copy Markdown
Member

I have missed the comment about adding a commit, sorry for early approval.

is the intent just to get the default in place

I have reviewed this PR based, on setting default in place, I have known about logo issue, before the PR was opened, and I wouldn't have wanted this PR to include these fixes.

But the logo was something that can be solved without the need for the PR to merge, so I was comfortable with it done in second PR, if you see an issue that need to be fixed in this PR, feel free to push the commit.

TD;LR: I wanted to set the default outline

@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.

LGMT upon resolving the conflicts.

@a2937

a2937 commented Mar 23, 2023

Copy link
Copy Markdown
Member Author

I tried to do a merge request but it probably failed.

@naomi-lgbt

Copy link
Copy Markdown
Member

Looks like it worked just fine 😁

@bbsmooth

Copy link
Copy Markdown
Contributor

To expand on my earlier comment. For example, in the steps, the focus outline on both the reset and ask for help buttons are not showing properly. Do we want to fix that in this PR? I haven't gone through every focusable element to ensure that the outline is showing properly. Is this something we want to verify before we merge this PR? Or should we just get these defaults merged now and then I will go through and fix any minor issues I find in separate PRs?

Also, I asked in the issue if we wanted the outline to wrap around the borders of buttons so that the border still shows or if we wanted the outline to cover the border. @ahmadabdolsaheb leaned toward covering the border, and so do I. So do we want to take care of that in this PR as well?

@Sboonny Sboonny assigned Sboonny and unassigned Sboonny Mar 23, 2023
@Sboonny
Sboonny marked this pull request as draft March 23, 2023 16:58
@Sboonny

Sboonny commented Mar 23, 2023 •

Copy link
Copy Markdown
Member

Sorry for the delay, I have investigated it more, and the lower-jaw buttons can be fixed, by removing the extra overflow property, if removing the property from .lower-jaw-icon-bar is all you plan to do with lowerjaw button, and make the outline cover the border feel free to push a commit, I will re-review it and merge it. 👍

If you are planning to do more, like cover the border of the lowerjaw button too, maybe it's better to do it in different PR, and add the text for the buttons 🤔.

Either way this shouldn't be merged with that lower-jaw's buttons looks

@Sboonny

Sboonny commented Mar 23, 2023 •

Copy link
Copy Markdown
Member

btw, the logo is broken 😞, my fix didn't help much.

I will create another PR turning the layout from flex to grid, and be done with it once and for all. I don't think this should be blocked by my future PR.

@bbsmooth

Copy link
Copy Markdown
Contributor

I pushed two fixes, one for the icon buttons in the lower jaw and one for the bread crumb links. I don't think I'm seeing any other blockers. There is some minor tweaking that probably needs to be done but that can be handled in separate PRs.

I'm going to hold of on officially reviewing this just a little longer as I really want to go through everything one last time but I can't do that until later this evening.

@raisedadead raisedadead removed the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Mar 24, 2023

@bbsmooth bbsmooth left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not finding any blockers that should prevent merging this PR. There are some minor issues I will address in separate PRs.

For what it's worth, you have my LGTM.

@Sboonny
Sboonny marked this pull request as ready for review March 24, 2023 18:31
@Sboonny
Sboonny merged commit 7a904e2 into freeCodeCamp:main Mar 24, 2023
@Sboonny

Sboonny commented Mar 24, 2023

Copy link
Copy Markdown
Member

Every time you give your approval, I feel safe that the site is on better state, thank you so much for this 👍

@a2937
a2937 deleted the focus-indicator-var-color branch March 27, 2023 14:41
Sembauke pushed a commit to Sembauke/freeCodeCamp that referenced this pull request Mar 29, 2023
* Create a focus indicator

* Use two different colors for the palletes.

* Use focus-visible instead.

* Remove redundant css

* Use blue-mid for the focus outline color.

* Add a global fallback.

* Clean up the rules some more.

* Remove some bootstrap styling.

* fix: display focus outline on all sides of lower jaw icon buttons

* fix: breadcrumb focus outlines

---------

Co-authored-by: Ahmad Abdolsaheb <[email protected]>
Co-authored-by: Bruce B <[email protected]>
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(a11y) Keyboard focus indicator

7 participants