Skip to content

JImage: width/height alone should be able to request a resize #779

Description

@romain-pm

<JImage node={x} width={640} height={400} /> type-checks and throws needsSizes at render: width/height are markup attributes only and never reach the URL, so nothing requests a resize. JImage.tsx's own JSDoc example is written that way, and JImage.spec.tsx adds slotWidth: 48 alongside them to work around it.

Why it matters beyond ergonomics: a Jahia module that rewrites rendered HTML server-side (smart-images) honours exactly the ?w= / ?h= URLs the query channel emits. On such an instance width/height could express the resize directly — and that is the syntax module developers expect to use, in JSP and TSX alike.

This conflicts with #767 point 3, which proposes making width/height a required pair that errors loudly instead. Both cannot hold, so please arbitrate:

  • derive a fixed slot (slotWidth = width) when no slot is given — the doc example then works as written; or
  • keep it an error, and state in the guide that requesting a resize always needs slotWidth / sizes / widths.

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