Skip to content

Conversation

@mayagbarnes
Copy link
Collaborator

Describe your changes

This PR resolves 2 font related issues for custom themes:

  1. Sidebar page navigation menu should use sidebar font
    Current:
    Screenshot 2025-11-05 at 11 57 45 a m
    After:
    Screenshot 2025-11-05 at 11 57 28 a m

  2. Fallback to Streamlit default font instead of browser default when font file can’t be found
    Current: result when theme.font set to invalid source
    Screenshot 2025-11-05 at 12 04 20 p m
    After:
    Screenshot 2025-11-05 at 12 04 46 p m

Testing Plan

  • JS Unit Tests: Added ✅
  • E2E Tests: ✅ Updated
  • Manual Testing: ✅

@mayagbarnes mayagbarnes added security-assessment-completed Security assessment has been completed for PR change:bugfix PR contains bug fix implementation impact:users PR changes affect end users labels Nov 5, 2025
@snyk-io
Copy link
Contributor

snyk-io bot commented Nov 5, 2025

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

✅ PR preview is ready!

Name Link
📦 Wheel file https://core-previews.s3-us-west-2.amazonaws.com/pr-12948/streamlit-1.51.0-py3-none-any.whl
📦 @streamlit/component-v2-lib Download from artifacts
🕹️ Preview app pr-12948.streamlit.app (☁️ Deploy here if not accessible)

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

📈 Significant wheel size change detected

The wheel file size has increased by 0.87% (threshold: 0.25%)

  • Current PR: 9874.31 KB
  • Latest develop: 9789.55 KB

Please verify this change is expected.

@mayagbarnes mayagbarnes marked this pull request as ready for review November 5, 2025 21:39
@mayagbarnes mayagbarnes requested a review from Copilot November 5, 2025 22:46
Copy link
Contributor

Copilot AI left a 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 updates the parseFont function to always append Streamlit's default font as a final fallback when custom fonts are used. This ensures that if custom fonts fail to load, Streamlit's default fonts are used instead of the browser's defaults.

Key Changes

  • Modified parseFont function to accept an optional fallbackFont parameter and always append it to the font string
  • Updated all call sites of parseFont to pass appropriate fallback fonts (sans-serif for body/heading, monospace for code)
  • Updated tests to reflect new behavior where all custom fonts have Streamlit's default fallback appended
  • Added navigation component styling to use theme's bodyFont

Reviewed Changes

Copilot reviewed 3 out of 9 changed files in this pull request and generated 2 comments.

File Description
frontend/lib/src/theme/utils.ts Modified parseFont to accept fallback parameter and always append it; updated all parseFont calls to pass appropriate fallbacks
frontend/lib/src/theme/utils.test.ts Updated test expectations to match new behavior; added tests for custom fallback parameter
frontend/app/src/components/Navigation/styled-components.ts Added fontFamily styling to sidebar navigation container
e2e_playwright/snapshots/linux/custom_url_base_test/custom_theme_with_url_base[webkit].png Updated snapshot to reflect visual changes from font fallback behavior

@mayagbarnes mayagbarnes merged commit 320712d into develop Nov 6, 2025
38 checks passed
@mayagbarnes mayagbarnes deleted the fix-fallback-font branch November 6, 2025 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:bugfix PR contains bug fix implementation impact:users PR changes affect end users security-assessment-completed Security assessment has been completed for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants