Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

add visual feedback for :focus #16

Closed
johlrich opened this issue Feb 22, 2018 · 0 comments
Closed

add visual feedback for :focus #16

johlrich opened this issue Feb 22, 2018 · 0 comments

Comments

@johlrich
Copy link

johlrich commented Feb 22, 2018

There should probably be some kind of visual feedback for when the switch is focused. In particular, it's nice for when tabbing through a form with keyboard.

I added the following snippet to achieve this, but not sure if this is necessarily the prettiest approach or if both elements need the feedback. Defaults were taken from the bulma button's defaults for focus.

$switch-focus-border-color: $link-focus-border !default
$switch-focus-box-shadow-size: 0 0 0 0.125em !default
$switch-focus-box-shadow-color: rgba($link, 0.25) !default

.switch[type="checkbox"]
  &:focus
    + label
      &::before
        border: 1px solid $switch-focus-border-color
        box-shadow: $switch-focus-box-shadow-size $switch-focus-box-shadow-color

      &::after
        border: 1px solid $switch-focus-border-color
        box-shadow: $switch-focus-box-shadow-size $switch-focus-box-shadow-color

Comparing focused/unfocused:
image

Thanks for all your work on these nice bulma extensions!

@Wikiki Wikiki closed this as completed in 000fc55 May 12, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant