Skip to content

Docs: flexWrap default is documented as wrap but code defaults to nowrap #759

Description

@kiwigitops

Problem

The README's CSS-support table at README.md (line 203) documents the default value for flexWrap as wrap:

<tr><td><code>flexWrap</code></td><td><code>wrap</code>, <code>nowrap</code>, <code>wrap-reverse</code>, default to <code>wrap</code></td><td></td></tr>

However, the actual implementation in src/handler/compute.ts (lines 264-274) passes Yoga.WRAP_NO_WRAP as the fallback when style.flexWrap is not set:

node.setFlexWrap(
  v(
    style.flexWrap,
    {
      wrap: Yoga.WRAP_WRAP,
      nowrap: Yoga.WRAP_NO_WRAP,
      'wrap-reverse': Yoga.WRAP_WRAP_REVERSE,
    },
    Yoga.WRAP_NO_WRAP, // <-- default
    'flexWrap'
  )
)

So a child element with no flexWrap specified actually defaults to nowrap, not wrap. (The root node is explicitly set to WRAP_WRAP in src/satori.ts, but that doesn't apply to user-authored child nodes — and it's the table of supported CSS properties that's misleading here.)

This also matches the standard CSS spec default (nowrap), so the code is correct and the docs are wrong.

Expected

The README should state the default as nowrap, consistent with both the implementation and the CSS spec.

Suggested fix

Change README.md line 203 from default to wrap to default to nowrap:

-<tr><td><code>flexWrap</code></td><td><code>wrap</code>, <code>nowrap</code>, <code>wrap-reverse</code>, default to <code>wrap</code></td><td></td></tr>
+<tr><td><code>flexWrap</code></td><td><code>wrap</code>, <code>nowrap</code>, <code>wrap-reverse</code>, default to <code>nowrap</code></td><td></td></tr>

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