Skip to content

Grid: Grid fails to properly layout children when child is a custom component returning multiple elements #6325

@sadie100

Description

@sadie100

Describe the bug

I've encountered an issue with the Grid component where it doesn't correctly layout its children when the child is a custom component that returns multiple elements wrapped in a React Fragment. I've created a Stackblitz example to demonstrate this behavior.

While I'm not certain of the underlying cause, in my experience, wrapper components typically manage to layout their children according to the specified configuration, even when those children are custom components. (For comparison, I've added an example in the Stackblitz demonstration showing how an HTML grid div successfully layouts the same custom component.)

Given this discrepancy between expected and actual behavior, I believe this might be a bug.

Any insights or guidance on this issue would be greatly appreciated. Always thankful for your time and attention.

Isolated Example

https://stackblitz.com/edit/github-yqwc1b-ave8oc?file=src%2FApp.tsx

Reproduction steps

  1. Create a Grid component with specified layout properties.
  2. Create a custom component that returns multiple elements wrapped in a React Fragment.
  3. Place this custom component as a direct child of the Grid.
  4. Observe that the Grid fails to apply the specified layout to the nested children.

Expected Behaviour

The Grid should apply its layout properties to the children of the custom component, similar to how it handles multiple elements when they're directly placed within the Grid.

Screenshots or Videos

Screenshot 2024-09-06 at 4 41 01 PM

UI5 Web Components for React Version

Our project has 1.28.1, but 2.1.0 StackBlitz example has same problem

UI5 Web Components Version

Our project : 1.24.2, StackBlitz : 2.2.2

Browser

Chrome

Operating System

mac Sonoma 14.3

Additional Context

No response

Relevant log output

No response

Organization

No response

Declaration

  • I’m not disclosing any internal or sensitive information.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions