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

[WDTK] Improved focus state for buttons #1917

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

lucascumsille
Copy link
Contributor

Relevant issue(s)

Discovered while working on a blog about accessibility for WDTK

What does this do?

Makes the focus state more obvious for users with visual impairments

Screenshots

Screen.Recording.2024-09-09.at.15.31.03.mov

Notes to reviewer

@garethrees
Copy link
Member

So nice! ✨

Copy link
Member

@gbp gbp left a comment

Choose a reason for hiding this comment

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

There are a few buttons I've found which don't have the new focus state.

All Pro styled buttons:
Screenshot 2024-09-16 at 09 42 23

Donate button in the footer:
Screenshot 2024-09-16 at 09 42 54

And the homepage "Make a request" button unfocused state is yellow so there isn't much difference when focused:
Screenshot 2024-09-16 at 09 44 15

Copy link
Member

@gbp gbp left a comment

Choose a reason for hiding this comment

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

@lucascumsille can I check if the focus state should be shown on all footer anchors or not. Seems a bit strange...

footer-active-state.mov

Copy link
Member

@gbp gbp left a comment

Choose a reason for hiding this comment

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

@lucascumsille also the yellow button on the homepage... looks like you've increased the size of boarder but haven't changed the colour of the button. Are you happy with the focus state on that now?

@lucascumsille
Copy link
Contributor Author

@gbp I have included the changes made on this PR on the current PR instead. I think with these commits, we should be covering all cases.

As a summary:

  • Added transition effect to footer button.
  • Added a more visible focus state. Using a light outline and a dark box-shadow with no blur, we cover scenarios where the button background has a different level of lightness.
    The default button has a hover effect and a background that is slightly different from white, so when hovering over it right next to a tertiary button, the user doesn't get confused.
    Remove transitions from hover effects. We don't need to duplicate them; as long as the transition is in the default state, the other states will inherit it.
    The styling for hover and focus has changed so that it changes only two properties compared with the default button, making it clearer for users with visual impairments.
  • The hover effect for the links in the footer wasn't accessible, so I made them lighter.

Pending(Potentially):

can I check if the focus state should be shown on all footer anchors or not. Seems a bit strange...

  • At the beginning, I included the focus state for links as well; I took as an inspiration GOVUK. It's not so strange, and might not be the most aesthetically pleasing effect, but it's familiar for users that use the keyboard to navigate. I didn't include it in this PR, though, because in your video, I noticed that it messed up links with logos(footer and navbar). But if you think those are the only two cases where we might end up with a problem, then it might be easier to add a rule to exclude those classes with logos(assuming we are happy to move ahead with the effect for the focus state with yellow bg).

We are currently using transitions for buttons. Do you want me to include one for the links as well? I was wondering if there was a reason why it wasn't included initially.

Preview

Screen.Recording.2024-09-19.at.11.21.21.mov
Screen.Recording.2024-09-19.at.11.19.21.mov
Screen.Recording.2024-09-19.at.10.36.37.mov
Screen.Recording.2024-09-19.at.10.35.46.mov

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.

3 participants