Navigate to home page on logo click#13222
Conversation
✅ 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!
|
There was a problem hiding this comment.
Pull request overview
This PR adds a new feature where clicking the logo in a multi-page app navigates to the home page when no explicit link is provided via st.logo. Previously, logos without an explicit link were non-interactive.
Key changes:
- Logos in multi-page apps now act as a home navigation button when no explicit
linkparameter is provided - The logo remains non-interactive in single-page apps and uses external links when explicitly configured
- Navigation only occurs when not already on the home page
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
frontend/app/src/components/Logo/LogoComponent.tsx |
Adds logic to render a clickable button for multi-page apps without explicit links, uses NavigationContext to navigate to the home page |
frontend/app/src/components/Sidebar/styled-components.ts |
Extracts shared logo link styles and adds new StyledLogoButton component with button reset styles |
frontend/app/src/components/Logo/LogoComponent.test.tsx |
Adds comprehensive test coverage for multi-page app home navigation scenarios |
e2e_playwright/multipage_apps_v2/mpa_v2_basics_test.py |
Adds e2e test verifying logo click navigation and removes snapshot assertion for removed external link feature |
e2e_playwright/multipage_apps_v2/mpa_v2_basics.py |
Removes explicit link parameter from st.logo call to test new home navigation behavior |
| dataTestId = "stLogo", | ||
| }: LogoComponentProps): ReactElement | null => { | ||
| const { resourceCrossOriginMode } = useContext(LibConfigContext) | ||
| const { appPages, onPageChange, currentPageScriptHash } = |
There was a problem hiding this comment.
Suggestion: In a MPA, when you are on the home page, this will still render the logo as a clickable button (with hover effect / cursor) - though its a bit more work I think it should only render as clickable button when not already on the home page
logo-button.mov
There was a problem hiding this comment.
good point, updated 👍
Describe your changes
If
st.logois used in an MPA app without specifying alink, it will do an internal redirect to the default/home page on click.GitHub Issue Link (if applicable)
linkinst.logoto link to one of the app pages #13155Testing Plan
Contribution License Agreement
By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.