Skip to content

fix(ui5-illustrated-message): correct resizing on height change#13035

Open
NakataCode wants to merge 1 commit intomainfrom
illustrated-message-correct-resizing
Open

fix(ui5-illustrated-message): correct resizing on height change#13035
NakataCode wants to merge 1 commit intomainfrom
illustrated-message-correct-resizing

Conversation

@NakataCode
Copy link
Contributor

@NakataCode NakataCode commented Feb 5, 2026

Problem

The IllustratedMessage component entered an infinite re-rendering loop when placed in a height-constrained container. The resize handler conflicted between width-based and height-based calculations:

  1. Width calculation selects larger illustration (SCENE)
  2. Height overflow triggers smaller illustration (SPOT)
  3. Re-render fires resize observer again
  4. Loop repeats: SCENE → SPOT → SCENE → SPOT...

This caused visual flickering and performance issues during resizing.

Solution

1. Height-Constrained Mode

  • Added _isHeightConstrained flag to lock into height-based calculation once overflow is detected
  • Prevents switching back to width-based sizing
  • Resets when container grows significantly (+10px)

2. Dimension-Based Cache

  • Tracks dimensions per media type
  • Blocks media switches if dimensions already match cached values (within 1px)
  • Prevents re-rendering cycles

3. Debounced Adjustments

  • Uses requestAnimationFrame cancellation to prevent multiple queued callbacks
  • Ensures only one adjustment runs per frame

4. Smart Early Return

  • Skips updates when calculated media matches current media

Cypress test - to be added!

Fixes: #12673

@ui5-webcomponents-bot
Copy link
Collaborator

@ui5-webcomponents-bot ui5-webcomponents-bot temporarily deployed to preview February 5, 2026 16:46 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IllustratedMessage: component does not resize correctly when the height is being changed

2 participants