Skip to content

WASM: text inside row![] inside button() clips to single character #3289

@JagritGumber

Description

@JagritGumber

Description

When targeting wasm32-unknown-unknown, placing a row![] with multiple text() widgets inside a button() causes the text content to be clipped to a single character. This does not occur on native (Linux/Vulkan).

Reproduction

// BROKEN on WASM — shows "I" instead of "Import"
button(
    row![
        text(icon_char).font(icon_font).size(16),
        text("Import").size(13),
    ]
    .spacing(6)
    .align_y(Alignment::Center)
)
.padding([6, 12])
.width(Length::Fill)
.style(primary_button_style)

// WORKS on WASM — shows full "Import"
button(
    text("Import").size(13).center()
)
.padding([6, 12])
.width(Length::Fill)
.style(primary_button_style)

Observations

  • Single text() inside button() renders correctly on WASM
  • row![] inside button() causes text to clip to 1 character on WASM
  • Same code renders correctly on native (Linux, Vulkan backend)
  • .width(Length::Fill) on the button may be a contributing factor, but removing it still shows the clipping when row![] is present
  • text() with explicit .font() is not the cause — tested with default font and explicit font, both clip inside row![]
  • row![] outside of button() (e.g., in a container) renders text correctly

Environment

  • iced 0.14
  • Target: wasm32-unknown-unknown
  • Built with trunk 0.21.14
  • Browser: Chrome (WebGPU enabled)
  • Works correctly on: Linux native (Vulkan)

Workaround

Use a single text() widget inside button() instead of row![]. For buttons that need an icon + label, either concatenate them in one string or place them outside the button.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions