-
Notifications
You must be signed in to change notification settings - Fork 4k
[fix] Resolving some regressions introduced via top nav #11732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ PR preview is ready!
|
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
…icated logic neglected expanded state as the failing tests indicate so addressing that here (hopefully)
…ut the logic we realllly care about here is on load, so im going to add this app.reload into here to check the thing i actually mean to check
…Introduced helper functions for viewport setup, sidebar state verification, and content visibility checks. Updated tests to use parameterization for different sidebar states and viewport sizes, enhancing maintainability and clarity.
5559b83 to
97a5cdc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes several UI regressions in the top navigation and main layout, addressing a race condition with window.innerWidth and a CSS overflow issue by adjusting layout styles and sidebar collapse logic. Key changes include:
- Updating StyledMainContent to use theme-based sizing and adding a minimum width while removing flex properties.
- Refactoring AppView’s sidebar collapse logic to use useLayoutEffect, useRef, and the shouldCollapse helper to resolve the window.innerWidth race condition.
- Adding comprehensive end-to-end tests for various sidebar states and responsive behaviors.
Reviewed Changes
Copilot reviewed 5 out of 53 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| frontend/app/src/components/AppView/styled-components.ts | Updated layout styles with theme.sizes.full and minWidth; removed flex styling. |
| frontend/app/src/components/AppView/AppView.tsx | Refactored sidebar collapse logic to mitigate race condition issues. |
| e2e_playwright/st_main_layout_test.py | Added E2E tests covering sidebar responsiveness and interaction. |
| e2e_playwright/st_main_layout.py | Introduced test app script with varied sidebar configuration. |
| e2e_playwright/conftest.py | Updated app server startup logic to use a helper function. |
Comments suppressed due to low confidence (1)
frontend/app/src/components/AppView/styled-components.ts:221
- The removal of the flex layout properties from StyledMainContent may impact the positioning of child elements. Please confirm that this change is intentional and that the layout still behaves as expected across all viewports.
height: "100vh",
| sidebar_header = app.get_by_test_id("stSidebarHeader") | ||
| sidebar_header.hover() | ||
|
|
||
| collapse_button = app.get_by_test_id("stSidebarCollapseButton").locator("button") | ||
| collapse_button.click() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I think it might be preventing some flakiness to always do and expect(collapse_button).to_be_visible() before performing actions like click / hover. But not 100% sure if that's actually the case.
`
lukasmasuch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
## Describe your changes Two main changes/bugs were fixed: 1. There was a race condition when apps were deployed such that window.innerWidth was coming back as 0, satisfying the `< breakpoints.md` condition. This was remedied with `useLayoutEffect`. This fixes #11710. 2. CSS unhappiness where it was growing until its `maxWidth`. This was fixed by adding a `minWidth: 0` to the appropriate spot. I also cleaned up some styles while touching those components. This fixes #11702 When I was creating an exhaustive test suite (`st_main_layout_test.py`) I realized there was actually another bug present. There was a missing case in the logic to account for the `EXPANDED` state for `initial_sidebar_state`. I then discovered that there already existed this helper in utils, with a lovely switch case that handled all of these. So I utilized that and this is now resolved. ## GitHub Issue Link (if applicable) Closes #11702 Closes #11710 ## Testing Plan I added e2e tests separate from the sidebar tests that focus specifically on the main layout of the app including the initial sidebar state, and various viewports, and uses snapshots to ensure content is not overflowing off the page as was shown in #11702. I think there's opportunity to better consolidate these tests, but this seems sufficient for now. --- **Contribution License Agreement** By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license. --------- Co-authored-by: Bob Nisco <[email protected]>
Describe your changes
Two main changes/bugs were fixed:
< breakpoints.mdcondition. This was remedied withuseLayoutEffect. This fixes Sidebar unexpectedly initializes collapsed in fullscreen app #11710.maxWidth. This was fixed by adding aminWidth: 0to the appropriate spot. I also cleaned up some styles while touching those components. This fixes Main content no longer resizes on sidebar expand/collapse #11702When I was creating an exhaustive test suite (
st_main_layout_test.py) I realized there was actually another bug present. There was a missing case in the logic to account for theEXPANDEDstate forinitial_sidebar_state. I then discovered that there already existed this helper in utils, with a lovely switch case that handled all of these. So I utilized that and this is now resolved.GitHub Issue Link (if applicable)
Closes #11702
Closes #11710
Testing Plan
I added e2e tests separate from the sidebar tests that focus specifically on the main layout of the app including the initial sidebar state, and various viewports, and uses snapshots to ensure content is not overflowing off the page as was shown in #11702. I think there's opportunity to better consolidate these tests, but this seems sufficient for now.
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.