patternfly / patternfly/patternfly-react

Bug - Table - mobile layout breaks alters table cell content layout unexpectedly

Open
#11,279 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Stale
Dominant language
TypeScript
Stars
862
Forks
392
Avg merge
4d 8h
Merged PRs (30d)
9

Description

Describe the problem

PF tables on mobile change the Td display from table-cell to grid. This has a side effect on mobile layout where every immediate child of the cell becomes a new grid item and gets stacked and elongated. The way to counteract this is to ensure that we always nest a <div> or some other block element immediately within the cell before adding our contents.

For example here’s what happens if we render a Label with adjacent Icon: eg <Td><Label> <Icon></Td>
Image
Image

How do you reproduce the problem?
Using web inspector on the Table examples found here: https://www.patternfly.org/components/table
When the window width is small enough to render the mobile view, observe the grid layout is applied and all table cell children become grid items.

Expected behavior
By default, the contents of the cell should render the same on desktop and mobile. The dev should need to go out of their way to opt into this other behavior.

Is this issue blocking you?
The work around is to always render a <div> as a the first immediate child of the table cell before rendering the cell contents within the div.

What is your environment?

  • OS: macos
  • Browser chrome
  • Version latest

What is your product and what release date are you targeting?
RHOAI

Any other information?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue in the PatternFly Table examples at the linked component page using a narrow browser window and inspect the Td layout. Start by tracing the Table/Td implementation and its mobile grid behavior. Done means cell contents such as adjacent Label and Icon render consistently on desktop and mobile without requiring consumers to add a wrapper.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.