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

css() isn't picking up pseudo-selector styles defined in emotion css prop #19

Open
kevinSuttle opened this issue May 3, 2019 · 5 comments

Comments

@kevinSuttle
Copy link
Contributor

kevinSuttle commented May 3, 2019

Is there something I'm missing?

css={css({':focus': {borderColor: 'blue20'}}

Image 2019-05-03 at 11 25 45 AM

This is being used on a <Flexbox /> component built in @emotion/styled + styled-system.

// @flow

import styled from '@emotion/styled';

import {
  alignItems,
  alignContent,
  justifyContent,
  justifyItems,
  flexWrap,
  flexBasis,
  flexDirection,
  flex,
  justifySelf,
  alignSelf,
  order,
} from 'styled-system';
import shouldForwardProp from '@styled-system/should-forward-prop';

import {Box} from './Box';

export const Flexbox = styled(Box, {
  shouldForwardProp,
})(
  {
    boxSizing: 'border-box',
    display: 'flex',
    label: 'flexbox-primitive',
  },
  alignItems,
  alignContent,
  justifyContent,
  justifyItems,
  flexWrap,
  flexBasis,
  flexDirection,
  flex,
  justifySelf,
  alignSelf,
  order
);

What's odd is that I can get it to work here: https://stackblitz.com/edit/react-zzznyy

@jxnblk
Copy link
Member

jxnblk commented May 3, 2019

What version of @styled-system/css are you using?

@kevinSuttle
Copy link
Contributor Author

2.0.0.

Actually, I think this might have been due to not having a border-width or style set.

@kevinSuttle
Copy link
Contributor Author

2.0.0.

Actually, I think this might have been due to not having a border-width or style set.

Edit: 2.0.0 fixes this. I misspoke. It's broken in 1.0.3.

@jxnblk
Copy link
Member

jxnblk commented May 3, 2019

Yeah, v2 should support borderColor (v1 does not) – I'd also check to make sure theme context is being passed through when you see things like this

@kevinSuttle
Copy link
Contributor Author

👍

Aside: I rolled back the version in the demo https://stackblitz.com/edit/react-zzznyy and it's showing some odd behavior. It's applying the focus color right away.

Image 2019-05-03 at 12 35 48 PM

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

No branches or pull requests

2 participants