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

Improve focus state of compressed EuiSwitch #2745

Merged
merged 6 commits into from
Jan 11, 2020

Conversation

andreadelrio
Copy link
Contributor

Summary

This PR improves the focus state of EuiSwitch compressed and EuiSwitch mini to make it more perceivable.

Desktop - 1

Focus state of EuiSwitch mini in EuiDataGrid

Desktop-grid

Fixes #2420

Checklist

  • Check against all themes for compatibility in both light and dark modes
  • [x Checked in mobile
  • Checked in IE11 and Firefox
    - [ ] Props have proper autodocs
    - [ ] Added documentation examples
    - [ ] Added or updated jest tests
    - [ ] Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

Copy link
Contributor

@myasonik myasonik left a comment

Choose a reason for hiding this comment

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

I will say that I still had some difficultly seeing the focused item but "some difficultly" is better than "practically can't at all" so this is definitely an improvement! Thank you!

@@ -46,6 +46,16 @@
}
}

@keyframes focusRingAnimateMini {
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious: What was your thought process behind creating new sized focus ring besides using an existing one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My first thought was to continue using focusRingAnimate and just increase the value of $euiFocusRingSize. However, then I realized there's a number of components using euiCustomControlFocused (and therefore euiFocusRing with the default size of small) that would be unnecessarily affected so I decided to create a new sized focus ring (focusRingAnimateMini) for this case.

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

I agree with @myasonik here that I actually had to zoom into the screenshot to see it at all. I'm wondering if the main problems stems back to the fact that the focus state only rings the switch thumb and not the entire thing. Being that it's on the thumb makes it blue on top of blue in parts and so makes it hard to see.

Maybe consider if we should move the focus to the whole switch and then maybe it can continue to use the default size of the focus ring instead of making an in-between size? Or if we think the default size is too small, maybe we should just bump it for everything?

@andreadelrio
Copy link
Contributor Author

andreadelrio commented Jan 10, 2020

So I tried giving the focus state to the whole switch instead of just the thumb and I like it a lot better. I also looked at some references and that seems to be the standard.

  1. Reference - Atlassian
    image
  2. Reference - Carbon (IBM)
    image
  3. Reference - Bootstrap
    image

Now, we'd have these two options: B or C. B uses the current default ring size ($euiFocusRingSize) and C bumps it up by 1px.

switch-3a

switch-3b

Like I mentioned in a previous comment, there are multiple components using $euiFocusRingSize which would have their focus state affected. Here's an example of how some of them would look like if we change $euiFocusRingSize to be 3px.

switch-3b-v2

All in all, I'm leaning towards option C where we increase the value of $euiFocusRingSize. However, I might be biased because I've been looking at this for too long. Do we need to increase the value of $euiFocusRingSize? or is giving a focus ring to the whole switch in EuiSwitch enough? What do you think? @cchaos @myasonik

@myasonik
Copy link
Contributor

I definitely agree, I like C for the switches too!

For the checkbox item below, it looks like you might have switched the "before" and "after" labels? Either way, I like what is currently labelled as "before" which, if they're not switched, does make a tricky situation...

@andreadelrio
Copy link
Contributor Author

I definitely agree, I like C for the switches too!

For the checkbox item below, it looks like you might have switched the "before" and "after" labels? Either way, I like what is currently labelled as "before" which, if they're not switched, does make a tricky situation...

Whoops, yes I had those switched. I updated my original comment to include a screenshot with proper labels.

@cchaos
Copy link
Contributor

cchaos commented Jan 10, 2020

Just move the focus from the thumb to the whole switch makes a HUGE difference and we should definitely move that direction. I am also on the side of making these focus states more obvious and bumping the ring size by 1px really helps do that (surprisingly).

I think we should be ok bumping the original $euiFocusRingSize for all components. 👍 I like it! It almost seems more proportional too somehow.

What you may want to do is a quick search in project for any components using that mixin and just do a quick test of the focus to make so there are no regressions.

@ryankeairns
Copy link
Contributor

Just passing by to say this looks really great! 👋

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Looks great to me!

@snide snide mentioned this pull request Jan 11, 2020
19 tasks
@andreadelrio andreadelrio merged commit 529603d into elastic:master Jan 11, 2020
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.

Mini switch focus styles aren't discernable
5 participants