fix(ebay-carousel): fix width calculation for last pill when font not loaded (#2344) #2352
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses the issue where the last pill in the
ebay-carousel
is partially hidden due to incorrect width calculation. The issue occurs because the width is calculated before the correct font (Market Sans) finishes loading, causing the fallback font (Arial) to be used during calculations.The changes ensure the component waits for the font to be fully loaded before performing width calculations. This prevents rendering issues and ensures the correct width is applied.
Context
The bug was reproduced on production. However, since this is a rendering issue caused by width calculations happening before the font is loaded, it is nearly impossible to reliably test locally.
These changes introduce logic to:
This approach ensures stability and resolves the issue effectively.
References
Screenshots
Before:
Screenshot not provided after the fix due to the nature of the rendering issue. The problem was reproduced in production, but it is difficult to capture accurately for testing locally.
Checklist