Skip to content

<interact-element> breaks CSS grid layout #182

@tombigel

Description

@tombigel

Package: @wix/interact/web

Description

The <interact-element> custom element as an unknown HTML element, browsers render it as display: inline, which breaks CSS grid placement when <interact-element> wraps a grid item.

This can be experienced specifically when adding interact programmatically to existing grid layouts with existing CSS rules.

Steps to reproduce

  1. Create a CSS grid container
  2. Place grid items inside with grid-column / grid-row placement rules specific to them
  3. Wrap one or more items in <interact-element data-interact-key="...">
  4. Observe that the wrapped items lose their grid placement and collapse to the top-left

Expected behavior

<interact-element> should be layout-transparent. Wrapping an element should not affect how it participates in its parent's layout context.

Workaround

Adding interact-element { display: contents } to the consuming application's CSS resolves the issue by making the wrapper invisible to the layout engine.

Suggested fix

Register a default style for the <interact-element> custom element

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions