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

unexpected behaviour of :global() #93

Closed
davibe opened this issue Jan 24, 2017 · 5 comments · Fixed by #144
Closed

unexpected behaviour of :global() #93

davibe opened this issue Jan 24, 2017 · 5 comments · Fixed by #144
Labels

Comments

@davibe
Copy link

davibe commented Jan 24, 2017

I would expect .root :global(p + p) { ... to work but it does not.

const Bug = () =>
  <div className="root">
    <p>red</p>
    <p>green</p>
    <p>blue</p>
  <style jsx>{`

  .root :global(p) {
    color: red;
  }

  /* this does not work */
  .root :global(p + p) {
    color: green;
  }

  /* this works */
  .root :global(p) + :global(p) {
    color: blue;
  }

  `}</style>
  </div>

To make things more clear i am creating a Typography element with css rules that are scoped to the .root element but are applied to all sub-element of sub-component. I do this to style markdown-rendered texts.

@giuseppeg giuseppeg added the bug label Jan 24, 2017
@giuseppeg
Copy link
Collaborator

should be fixed by #134

@michalwerner
Copy link

I have styled-jsx from master branch with #134 but I still can't do anything more than single selector in prefixed :global. For example:

this works

<style jsx>{`
  .menu :global(li) {
    color: red;
  }
`}

this does not work:

<style jsx>{`
  .menu :global(ul li) {
   color: red;
  }
  .menu :global(ul > li) {
   color: red;
  }
  .menu :global(li + li) {
    color: red;
  }
`}

but this also works (no .menu prefix):

<style jsx>{`
  :global(ul li) {
    color: red;
  }
`}

Is this intended behavior?

@thysultan
Copy link
Contributor

This is a bug, fixed upstream(stylis v1.2.2).

@rauchg
Copy link
Member

rauchg commented Mar 5, 2017

@thysultan should we bump?

@thysultan
Copy link
Contributor

@rauchg I'll send a PR.

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

Successfully merging a pull request may close this issue.

5 participants