[fix] st.exception links overflow at small widths#14417
[fix] st.exception links overflow at small widths#14417sfc-gh-lwilby merged 3 commits intodevelopfrom
Conversation
Add flexWrap to StyledExceptionLinks so links wrap instead of overflowing when the container is narrow. Fixes #12870 Made-with: Cursor Co-authored-by: lawilby <[email protected]>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ PR preview is ready!
|
xr843
left a comment
There was a problem hiding this comment.
LGTM! Clean fix — flexWrap: "wrap" is exactly the right approach for handling narrow container widths. Good catch also removing the unused underline: true property (it's not a valid CSS/Emotion property on a div anyway).
One minor note: the existing e2e test for fixed_width (200px) should now capture the wrapped link state in its snapshot, which will serve as regression coverage for this fix.
Delete stale fixed_width snapshots (height changed due to flexWrap) and add a dedicated 250px-width test that verifies footer links (Copy, Ask Google, Ask ChatGPT) remain visible when they wrap. Made-with: Cursor Co-authored-by: lawilby <[email protected]>
There was a problem hiding this comment.
Pull request overview
Fixes st.exception footer links (Copy / Ask Google / Ask ChatGPT) overflowing at narrow widths by allowing the link row to wrap, and updates E2E coverage/snapshots to validate the narrow-width rendering (Issue #12870).
Changes:
- Add
flexWrap: "wrap"to the exception footer link container and remove an invalid CSS property. - Add a new narrow-width
st.exceptionscenario in the E2E app. - Extend the
st_exceptionPlaywright test with an additional snapshot + visibility assertions and update expected element counts/snapshots.
Reviewed changes
Copilot reviewed 3 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/lib/src/components/elements/ExceptionElement/styled-components.ts | Enables wrapping for exception footer links and removes invalid CSS. |
| e2e_playwright/st_exception.py | Adds a narrow-width st.exception example used by E2E snapshots. |
| e2e_playwright/st_exception_test.py | Adds a new snapshot assertion for narrow-width link wrapping and updates indices/counts. |
| e2e_playwright/snapshots/linux/st_exception_test/st_exception-fixed_width[light_theme-webkit].png | Snapshot update for fixed-width exception rendering. |
| e2e_playwright/snapshots/linux/st_exception_test/st_exception-fixed_width[light_theme-firefox].png | Snapshot update for fixed-width exception rendering. |
| e2e_playwright/snapshots/linux/st_exception_test/st_exception-fixed_width[light_theme-chromium].png | Snapshot update for fixed-width exception rendering. |
| e2e_playwright/snapshots/linux/st_exception_test/st_exception-fixed_width[dark_theme-webkit].png | Snapshot update for fixed-width exception rendering. |
| e2e_playwright/snapshots/linux/st_exception_test/st_exception-fixed_width[dark_theme-firefox].png | Snapshot update for fixed-width exception rendering. |
| e2e_playwright/snapshots/linux/st_exception_test/st_exception-fixed_width[dark_theme-chromium].png | Snapshot update for fixed-width exception rendering. |
| narrow_exception = themed_app.get_by_test_id("stException").nth(5) | ||
| assert_snapshot(narrow_exception, name="st_exception-narrow_width_link_wrap") | ||
| expect(narrow_exception.get_by_role("button", name="Copy")).to_be_visible() | ||
| expect(narrow_exception.get_by_role("link", name="Ask Google")).to_be_visible() |
There was a problem hiding this comment.
The new assert_snapshot(..., name="st_exception-narrow_width_link_wrap") introduces a new snapshot name, but the corresponding baseline images are not present under e2e_playwright/__snapshots__/linux/st_exception_test/. With the current assert_snapshot fixture, missing baselines are written and then the test fails at the end, so CI will fail until the expected snapshots for this new name are committed.
There was a problem hiding this comment.
Resolved — the baseline snapshots for both st_exception-narrow_width_link_wrap and the updated st_exception-fixed_width were committed in b102a40 via make update-snapshots.
| # Verify that footer links wrap and remain visible at narrow widths (#12870) | ||
| narrow_exception = themed_app.get_by_test_id("stException").nth(5) | ||
| assert_snapshot(narrow_exception, name="st_exception-narrow_width_link_wrap") |
There was a problem hiding this comment.
The PR description/testing plan says no new E2E test is needed and only mentions unit tests, but this PR adds/updates Playwright E2E coverage (new app scenario + new snapshot assertion). Please update the PR description/testing plan to reflect the actual test changes so reviewers/CI expectations are clear.
There was a problem hiding this comment.
Good catch — updated the PR description to reflect the E2E test additions.
| # Verify that footer links wrap and remain visible at narrow widths (#12870) | ||
| narrow_exception = themed_app.get_by_test_id("stException").nth(5) | ||
| assert_snapshot(narrow_exception, name="st_exception-narrow_width_link_wrap") |
There was a problem hiding this comment.
Using get_by_test_id("stException").nth(5) makes this test brittle: adding/removing exceptions in st_exception.py forces re-numbering indices and updating the expected count. Consider wrapping the narrow-width exception in st.container(key=...) (or similar) and locating it via get_element_by_key(...) instead of relying on nth(...).
There was a problem hiding this comment.
This is consistent with how the existing test locates all other exceptions in this file (nth(0) through nth(4) for basic, long_message, with_markdown, fixed_width, stretch_width). Changing just the new one to use get_element_by_key would be inconsistent. A refactor of all locators in this test would be a separate improvement.
Regenerate fixed_width snapshots (taller due to flexWrap) and add new narrow_width_link_wrap snapshots via make update-snapshots. Made-with: Cursor Co-authored-by: lawilby <[email protected]>
Describe your changes
st.exceptionfooter links (Copy, Ask Google, Ask ChatGPT) overflow their container at narrow widths because the flex container lacks wrapping.flexWrap: "wrap"toStyledExceptionLinksso links wrap to new lines when space is tightunderline: trueCSS property (not a valid CSS value; had no effect)st_exception-fixed_widthsnapshots (taller due to wrapped links)Fixes #12870
Screenshot or video (only for visual changes)
Desktop (narrow column) — links wrap gracefully:
Mobile (375px):
GitHub Issue Link (if applicable)
#12870
Testing Plan
Existing ExceptionElement unit tests pass (13/13). Added a dedicated E2E test (
st_exception-narrow_width_link_wrap) that renders an exception at 250px width and asserts all footer links (Copy, Ask Google, Ask ChatGPT) remain visible when they wrap. Updatedst_exception-fixed_widthsnapshots to reflect the corrected wrapped-links rendering.Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.