Skip to content

CSS Container query specificity issue #48264

Closed

Description

@glued

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

Container query composition is missing the component's scope

image

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

Container queries aren't working as expected

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 15.0.1
Node: 16.13.2
Package Manager: npm 8.1.2
OS: darwin arm64

Angular: 15.0.1
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1500.1
@angular-devkit/build-angular   15.0.1
@angular-devkit/core            15.0.1
@angular-devkit/schematics      15.0.1
@schematics/angular             15.0.1
rxjs                            7.5.7
typescript                      4.8.4

Anything else?

No response

Activity

  1. added
    area: core
    on Nov 29, 2022
  2. modified the milestone: needsTriage on Nov 29, 2022
  3. glued commented on Nov 29, 2022

    @glued
    Author

    Also worth noting that container-name will need need to be scoped per component as well.
    https://developer.mozilla.org/en-US/docs/Web/CSS/container-name

  4. glued commented on Nov 30, 2022

    @glued
    Author
  5. dario-piotrowicz commented on Dec 4, 2022

    @dario-piotrowicz
    Contributor

    @glued I've opened a PR which fixed your issue 🙂

    But I did not add scoping for the container names as I am not completely sure if that is wanted/needed, do container apply from outside real native shadowDoms?

    This stackblitz example shows that that is actually the case (in Chrome 107 at least)

    If you look at the css specs (and in particular this w3c issue) it seems like it is not really clear what the relationship with shadow Dom boundaries is 😕

    So I guess for now we may not scope the names? what do you think?


    Additionally... I am a bit worried of how container queries without container names can work in the emulated shadow dom if the specs will specify that shadow dom boundaries should apply.
    Since the browser is going to take an element and look up the dom for its nearest container anchestor, it feels like we may not have a way to prevent that.... (unless we come up with some serious hack?)

    So either way, if we can't enforce the emulated shadow dom boundaries for unnamed containers I wonder if enforcing them for named containers (which we can definitely do) would make the whole thing inconsistent and confusing 😕

  6. added a commit that references this issue on Dec 6, 2022
    9a5d842
  7. angular-automatic-lock-bot commented on Jan 6, 2023

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  8. locked and limited conversation to collaborators on Jan 6, 2023
  9. added a commit that references this issue on Feb 1, 2023
    773dc1f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: corecore: CSS encapsulationcore: stylesheets

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions