Skip to content

Hidden <label> inserted by cmdk breaks layout inside flex containers & popovers #391

Description

@matejmich

When using cmdk (via shadcn/ui’s <Command />) inside a flex container or popover, the automatically inserted hidden <label cmdk-label> element causes the layout to break.

Even though the label is visually clipped, the browser still measures it, which results in:

parent flex containers stretching

scroll regions collapsing

popovers miscalculating their anchor position

full-page white-out / layout shift

This happend inside nested flex layout with auto height for me. Don't know if that's relevant/

Work around

<Command className="[&>label]:hidden">
this fixed the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions