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

Nested SCSS selectors global by default #592

Open
SamMousa opened this issue Apr 25, 2023 · 0 comments
Open

Nested SCSS selectors global by default #592

SamMousa opened this issue Apr 25, 2023 · 0 comments

Comments

@SamMousa
Copy link

Is your feature request related to a problem? Please describe.
I'm always frustrated when I use nested SCSS and have to apply :global() at all nested levels.

Describe the solution you'd like
CSS scoping already happens at the top level of my selector, so there's no need to also scope any child selectors since they are already scoped to the component by their parent selector.

Describe alternatives you've considered
Currently I wrap everything in :global():

.imagemap {
        min-height: 200px;
        background-color: red;
        width: 100%;
        position: relative;
        canvas {
            width: 100% !important;
            height: 100% !important;
            min-width: 100%;
            max-width: 100%;
            min-height: 100%;
            max-height: 100%;
        }

        :global(.canvas-wrapper) {
            z-index: 10;
            display: none;
        }

        :global(.canvas-wrapper.loaded) {
            display: block;
        }

        &[data-hover] {
            cursor: pointer;
        }
    }

How important is this feature to you?
There is a workable workaround; it just doesn't feel clean. I'm writing code that works but its meaning is different from what is conveyed. I'm not creating global styles; I'm creating component scoped styles that happen to have multiple selectors.

Additional context

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

1 participant