react / react/yoga

Non-spec behavior using alignItems: center

Open
#1,704 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Algorithm
Dominant language
C++
Stars
18.9k
Forks
1.6k
Avg merge
1m
Merged PRs (30d)
1

Description

Report

Issues and Steps to Reproduce

Here is a playground in which we can see that setting alignItems: 'center' actually allows the content to grow bigger than it's container.

Broken playground

Expected Behavior

When setting alignItems: center, content should stay within bounds.

We made a reproduction in codepen.

ℹ️ Note: We are not sure using flexBasis is the best way to emulate a component from react-native but it seems to be okay.

⚠️ Note 2: Fun fact, when using React Native and Old yoga errata settings (classic), this bug is harder to trigger as it needs an extra to happen, see this playground. I believe this has allowed this bug to be uncommon for most yoga users (that would be using react native). If more users start using a stricter errata, it will be a much bigger issue I believe.

Actual Behavior

The content overflows

Link to Code

See playground

Let me know if there is anything else that would be needed to get this fixed. Thanks 🫡

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

Start by reproducing the overflow in the linked Yoga playground and CodePen, comparing alignItems: 'center' with the shown flexBasis setup and errata settings. Trace the layout behavior responsible for content exceeding its container; done means the reproduction stays within bounds under the reported settings, including the stricter errata case.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.