Skip to content

Support container-type: anchored and @container anchored() #1176

@tirtza-weinfeld

Description

@tirtza-weinfeld

Summary

container-type: anchored (Chrome 143+) and @container anchored(fallback: ...) fail to parse.

Input

.popover {
  container-type: anchored;
  position-try-fallbacks: flip-block;
}

@container anchored(fallback: flip-block) {
  .popover-arrow {
    inset-block-start: auto;
    inset-block-end: calc(-0.5rem + 1px);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
  }
}

Error

Unexpected token Function("anchored")

Context

container-type: anchored enables anchor fallback detection on positioned elements. @container anchored(fallback: <try-fallback>) queries which position-try-fallbacks option was chosen, allowing styles (e.g. arrow direction) to adapt.

This blocks all Turbopack-based Next.js apps from using anchored container queries since Turbopack uses lightningcss for CSS parsing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions