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

fix(css): self-nesting works wrong way with conditions #3062

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nnnnoel
Copy link

@nnnnoel nnnnoel commented Dec 24, 2024

📝 Description

Fixed multiple conditions order with self-nesting, mixed.

Add a brief description

Repro step

  1. Setup panda.config.ts
export default defineConfig({
  // ...other options
  conditions: {
  extend: {
      hover: [
        '@media (hover: hover) and (pointer: fine)',
        '&:is(:hover, [data-hover])',
        '&:not(:disabled, [disabled], [data-disabled])',
        '&:not([data-loading])',
      ],
      disabled: ['&:is(:disabled, [disabled], [data-disabled])', '&:not([data-loading])'],
    },
  },
  outdir: 'styled-system',
  outExtension: 'js',
  jsxFramework: 'react',
});
  1. define self-nesting css that can select multiple elements
const Breadcrumb = ({ className }: { className?: string }) => {
  return (
    <nav aria-label='Breadcrumb' className={className}>
      <ul
        className={flex({
          gap: 4,
          align: 'center',
          '& li': {
            display: 'flex',
            alignItems: 'center',
          },
          '& *': {
            color: 'content.default.level-2',
            textStyle: 'Text/M/Strong',
          },
          '& a': {
            transition: 'color .3s',
            _hover: {
              color: 'content.interaction.hover',
            },
          },
        })}
      >
        <li>
          <a href='/'>Home</a>
        </li>
        <li>
          <a href='/blog'>Blog</a>
        </li>
      </ul>
    </nav>
  );
};

export default Breadcrumb;

at the above, _hover selector is nested in & a selector.
but current behavior, that style applied when ul is hovered and applied all of a elements.

⛳️ Current behavior (updates)

Please describe the current behavior that you are modifying

🚀 New behavior

Please describe the behavior or changes this PR adds

💣 Is this a breaking change (Yes/No):

Maybe No

📝 Additional Information

Copy link

changeset-bot bot commented Dec 24, 2024

🦋 Changeset detected

Latest commit: b9af232

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 19 packages
Name Type
@pandacss/core Patch
@pandacss/generator Patch
@pandacss/node Patch
@pandacss/parser Patch
@pandacss/astro-plugin-studio Patch
@pandacss/dev Patch
@pandacss/postcss Patch
@pandacss/studio Patch
@pandacss/config Patch
@pandacss/extractor Patch
@pandacss/is-valid-prop Patch
@pandacss/logger Patch
@pandacss/preset-atlaskit Patch
@pandacss/preset-base Patch
@pandacss/preset-open-props Patch
@pandacss/preset-panda Patch
@pandacss/shared Patch
@pandacss/token-dictionary Patch
@pandacss/types Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Dec 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
panda-docs ✅ Ready (Inspect) Visit Preview Dec 24, 2024 10:56am
panda-playground ✅ Ready (Inspect) Visit Preview Dec 24, 2024 10:56am
panda-studio ✅ Ready (Inspect) Visit Preview Dec 24, 2024 10:56am

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

Successfully merging this pull request may close these issues.

1 participant