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

Make focus style easier to change #220

Open
jfrankl opened this issue Aug 15, 2019 · 4 comments
Open

Make focus style easier to change #220

jfrankl opened this issue Aug 15, 2019 · 4 comments

Comments

@jfrankl
Copy link
Contributor

jfrankl commented Aug 15, 2019

Right now the :focus style of a box-shadow is difficult to override or change:

https://github.com/raster-foundry/blasterjs/blob/develop/packages/core/components/button/index.js#L193

I want to remove the box-shadow. I can't figure out a way to do that without also removing box-shadows on buttons that I want to be there, that are part of the default, non-focus style.

Consider using outline instead of box-shadow, because outline is less commonly used for styling outside of focus.

@lederer
Copy link
Contributor

lederer commented Aug 15, 2019

Noticed an errant comma in that file as well at line 64:

  transition: 0.1s ease-in-out, box-shadow, 0.1s ease-in-out background-color;

@jfrankl
Copy link
Contributor Author

jfrankl commented Aug 15, 2019

I just noticed that @lederer is working on #219. That is huge. Having these focus box-shadows not appear on click will make it a lot less urgent to be able to modify the focus style.

@lederer
Copy link
Contributor

lederer commented Aug 15, 2019

Great. #219 should land first, but I think we should still address this issue afterwards. Stay tuned!

@designmatty
Copy link
Contributor

@jfrankl with the latest release there is a way to target a specific element's focus.

Within the theme object styles: css of the component you want to target, in this case, Button, you can target the focus by defining:

.js-focus-visible &.focus-visible {
        //you focus treatment styling here
}

So the final theme object might look like:

button: {
    styles: css`
      .js-focus-visible &.focus-visible {
        box-shadow: none;
        outline: 1px solid pink;
        color: pink;
      }
    `
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants