Skip to content

[bugfix] Multiselect dropdown background matches sidebar theme (#11348) - #16163

Merged
sfc-gh-dbyttow merged 2 commits into
developfrom
bugfix/issue-11348-sidebar-multiselect-bg
Jul 27, 2026
Merged

[bugfix] Multiselect dropdown background matches sidebar theme (#11348)#16163
sfc-gh-dbyttow merged 2 commits into
developfrom
bugfix/issue-11348-sidebar-multiselect-bg

Conversation

@sfc-gh-dbyttow

@sfc-gh-dbyttow sfc-gh-dbyttow commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #11348.

Root cause: BaseWeb's menuFill (used by the Select dropdown list) resolves to secondaryBg when rendered inside the sidebar. See frontend/lib/src/theme/createBaseUiTheme.tsmainPaneBgColor = inSidebar ? colors.secondaryBg : colors.bgColor. The intent of that swap was to compensate for the sidebar's default bg/secondaryBg inversion, but when the user explicitly sets both [theme.sidebar] backgroundColor and secondaryBackgroundColor, the fallback paints the multiselect dropdown with the sidebar's secondaryBackgroundColor (goldenrod in the issue's repro) instead of its backgroundColor.

The multiselect popover is portalled to document.body, so no ancestor CSS variable cascade can help — the fix has to be in the component itself.

Repro

Set the theme colours from the issue in .streamlit/config.toml, place a multiselect in the sidebar, open the dropdown, and observe the mismatched background.

Fix

  • Override the StyledList backgroundColor in VirtualDropdown with theme.colors.bgColor, which — inside the sidebar-scoped emotion theme — resolves to the sidebar's configured backgroundColor, and in the main body resolves to the app's backgroundColor (unchanged).
  • The override applies to both the populated list and the empty state to keep them consistent.

Screenshots

After the fix (repro config: sidebar backgroundColor = "#262730", sidebar secondaryBackgroundColor = "goldenrod"), the open sidebar multiselect dropdown paints on the sidebar's backgroundColor and no longer picks up goldenrod:

Verification

  • Sidebar dropdown bg matches sidebar bg after fix (#262730 in repro)
  • Main-area dropdown bg unchanged (#0e1117 in repro)
  • make check passes (frontend format, lint, knip, tsc, VirtualDropdown vitest)
  • Full Multiselect + VirtualDropdown vitest suites pass (57/57)

Note

Low Risk
Localized styling override in the virtualized select dropdown with no auth, data, or API changes.

Overview
Fixes sidebar multiselect dropdowns painting with the wrong surface when both [theme.sidebar] backgroundColor and secondaryBackgroundColor are set.

VirtualDropdown now sets StyledList backgroundColor to theme.colors.bgColor (via a shared menuFillOverride) on both the populated list and the empty state. That bypasses BaseWeb’s menuFill, which in sidebar context maps to secondaryBg and showed the secondary color (e.g. goldenrod) instead of the sidebar’s primary background. Main-area dropdowns stay on the app backgroundColor because the same token resolves correctly there.

Reviewed by Cursor Bugbot for commit f115932. Bugbot is set up for automated code reviews on this repo. Configure here.

@snyk-io

snyk-io Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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

Status Scan Engine Image Critical Image High Image Medium Image 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

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

✅ PR preview is ready!

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

@sfc-gh-dbyttow sfc-gh-dbyttow added impact:users PR changes affect end users change:bugfix PR contains bug fix implementation ai-review If applied to PR or issue will run AI review workflow labels Jul 26, 2026
@github-actions github-actions Bot removed the ai-review If applied to PR or issue will run AI review workflow label Jul 26, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR fixes a sidebar theming bug (issue #11348) where multiselect and selectbox dropdown backgrounds rendered with the wrong color when both sidebar.backgroundColor and sidebar.secondaryBackgroundColor are explicitly configured. The root cause is BaseWeb's menuFill resolution heuristic in createBaseUiTheme.ts, which incorrectly "unswaps" sidebar colors. The fix adds an explicit backgroundColor: theme.colors.bgColor override on the StyledList $style in VirtualDropdown.tsx, applied in both the empty-state and populated-list render paths.

Only one file is changed: frontend/lib/src/components/shared/Dropdown/VirtualDropdown.tsx.

Reviewer agreement: Both reviewers (claude-4.6-opus-high-thinking and gpt-5.3-codex-high) agreed that:

  • The fix is correct, minimal, and well-targeted
  • It follows existing patterns (the $style object already overrides boxShadow, padding, etc.)
  • It correctly uses theme.colors.bgColor from the emotion theme, consistent with frontend theming guidelines
  • No backwards compatibility, security, or accessibility concerns exist
  • No external test coverage is needed

Reviewer disagreement: The reviewers diverged on whether missing automated tests should block the merge. claude-4.6-opus-high-thinking approved (tests are nice-to-have for a CSS-only fix), while gpt-5.3-codex-high requested changes (regression tests required before merge). See Test Coverage and Verdict sections for resolution.

Code Quality

The change is minimal and follows existing patterns in the file. The $style object on StyledList already overrides several BaseWeb defaults (boxShadow, padding, overflow), and adding backgroundColor is consistent with that approach. The fix uses theme.colors.bgColor from the emotion theme context, which correctly resolves to the region-appropriate background color in both sidebar and main-area contexts — fully aligned with the frontend AGENTS.md guideline to prefer theme properties from useEmotionTheme().

The duplicated comment block across the two StyledList render paths (empty-state and populated-list) is acceptable since the two renderings are structurally separate and the comment explains non-obvious behavior.

Test Coverage

No new unit or e2e tests are added. Both reviewers noted this gap. The existing VirtualDropdown.test.tsx tests verify rendering behavior but do not assert background color styling.

Assessment: While a regression test would be valuable, the lack of one is not merge-blocking for this change because:

  1. The fix is a pure CSS override with no logic branching — it sets a single backgroundColor property
  2. The behavior depends on sidebar theme context, which is most meaningfully validated via e2e tests, not unit tests asserting CSS properties
  3. Unit tests asserting specific CSS properties on BaseWeb styled components are fragile and tightly coupled to implementation details
  4. The override is strictly additive and produces the same result as menuFill in the default (non-custom-sidebar-theme) case

Tests are recommended as a follow-up but should not block this merge.

Backwards Compatibility

No breaking changes. The override produces the same value that menuFill already resolves to in the default case (no custom sidebar theme). Existing non-sidebar dropdowns and sidebar dropdowns without explicit sidebar theme colors will render identically. No public API, protobuf, backend contract, or config schema changes are introduced.

Security & Risk

No security concerns. The change is a pure CSS styling override with no impact on WebSocket endpoints, file handling, authentication, session management, HTML/Markdown rendering, dependencies, or external assets. Regression risk is low — the override is strictly additive and the value (theme.colors.bgColor) is always the correct background color for the current rendering region.

External test recommendation

  • Recommend external_test: No
  • Triggered categories: None
  • Evidence:
    • frontend/lib/src/components/shared/Dropdown/VirtualDropdown.tsx: Pure CSS backgroundColor override on a BaseWeb StyledList. No routing, auth, WebSocket, embedding, asset serving, CORS, CSP, storage, or SiS runtime changes.
  • Suggested external_test focus areas: N/A
  • Confidence: High
  • Assumptions and gaps: None — the change is entirely within the frontend presentation layer with no external-facing behavior changes.

Accessibility

No accessibility impact. The change modifies only the backgroundColor CSS property on existing list elements. It does not alter semantic HTML, ARIA attributes, focus management, keyboard navigation, or screen reader behavior. Color contrast is not degraded — the background now correctly matches the region's configured backgroundColor, which is the color users design their theme against.

Readability

VirtualDropdown.tsx — Inline comments (lines 115–119, 188–192)

Both reviewers noted the duplicated 4-line comment is slightly verbose and includes issue-specific phrasing ("goldenrod dropdown"). The comment explains the "why" well, which is important since the override is non-obvious, but could be tightened.

Proposed rewrite:

// Override BaseWeb's `menuFill`, which resolves to the sidebar's
// `secondaryBackgroundColor` instead of `backgroundColor` when both
// sidebar bg colors are explicitly configured (#11348).

This is a minor style preference and not merge-blocking.

PR title and description

The PR title is clear and self-contained. The description is well-structured with clear sections covering summary, repro steps, fix explanation, and verification. No rewrites needed — the description effectively communicates the change to reviewers.

Recommendations

  1. (Optional, non-blocking) Consider adding an e2e test in e2e_playwright/ that configures custom sidebar theme colors (sidebar.backgroundColor and sidebar.secondaryBackgroundColor) and validates the multiselect dropdown background color in both the sidebar and main area.

  2. (Optional, non-blocking) Consider adding a unit test asserting backgroundColor on the rendered StyledList element (both empty and populated states) to catch regressions if BaseWeb's $style merging behavior changes.

  3. (Optional, non-blocking) Shorten the inline comment by removing the "goldenrod" reference (see Readability section).

Verdict

APPROVED: Clean, minimal, well-targeted CSS fix for a real theming bug. The change correctly uses theme.colors.bgColor to override BaseWeb's flawed menuFill resolution in sidebar contexts, follows existing patterns in the file, and has no backwards compatibility, security, or accessibility concerns. The lack of automated tests is noted but not merge-blocking for a single-property CSS override — tests can be added in a follow-up.

Reviewer breakdown:

  • claude-4.6-opus-high-thinking: APPROVED
  • gpt-5.3-codex-high: CHANGES_REQUESTED (missing regression tests)

Conflict resolution: The gpt-5.3-codex-high review's CHANGES_REQUESTED verdict was based solely on missing automated test coverage. Per the verdict criteria, "optional improvements, style preferences, and 'nice to have' suggestions should NOT result in CHANGES REQUESTED." For a pure CSS override with no logic branching, automated tests are a best-practice improvement rather than a merge-blocking requirement. The fix itself is correct and low-risk. Approving with a recommendation to add tests in a follow-up.


This is a consolidated AI review by claude-4.6-opus-high-thinking, synthesizing reviews from claude-4.6-opus-high-thinking and gpt-5.3-codex-high.

@sfc-gh-dbyttow

Copy link
Copy Markdown
Contributor Author

Thanks for the AI review — noting the verdict is APPROVED with three non-blocking optional recommendations:

  1. e2e test for sidebar dropdown bg — deferring to a follow-up; agree with the consolidator that a single-property CSS override on a BaseWeb $style is more meaningfully covered by e2e than unit tests, and this can land alongside broader sidebar-theme e2e coverage.
  2. Unit test asserting backgroundColor — declining; asserting BaseWeb-styled-component CSS in Vitest is fragile and tightly coupled to internals, per the reviewer’s own caveat.
  3. Shorten the inline comment (remove "goldenrod") — declining as out of scope for this bugfix; the wording is a minor style nit and the current comment explains the non-obvious BaseWeb menuFill behavior clearly.

Marking ready for human review.

@sfc-gh-dbyttow
sfc-gh-dbyttow marked this pull request as ready for review July 26, 2026 22:07
@greptile-apps

greptile-apps Bot commented Jul 26, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a localized dropdown background override.

  • Uses the active region theme’s bgColor for populated and empty virtual dropdown lists.
  • Keeps sidebar dropdown surfaces aligned with an explicitly configured sidebar background.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
frontend/lib/src/components/shared/Dropdown/VirtualDropdown.tsx Applies the region-scoped theme background to both dropdown list states; no eligible follow-up issue was identified.

Reviews (3): Last reviewed commit: "Address review nits: hoist shared menuFi..." | Re-trigger Greptile

@sfc-gh-lmasuch sfc-gh-lmasuch added the ai-final-review If applied to PR or issue will run AI review workflow with the latest generation of AI models. label Jul 27, 2026
@github-actions github-actions Bot removed the ai-final-review If applied to PR or issue will run AI review workflow with the latest generation of AI models. label Jul 27, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR fixes #11348: a sidebar dropdown (st.multiselect and, since they share the same BaseWeb Select/VirtualDropdown, st.selectbox) renders its popover with the wrong background when a theme configures both [theme.sidebar] backgroundColor and secondaryBackgroundColor. The portalled dropdown picked up BaseWeb's menuFill, which resolves to the sidebar's secondaryBackgroundColor instead of its backgroundColor.

The change is small and frontend-only: VirtualDropdown.tsx now sets backgroundColor: theme.colors.bgColor on the StyledList $style of both the populated list and the empty-state list, overriding menuFill. All three reviewers agree the fix is correct, minimal, and well-scoped, and that it applies to both selectbox and multiselect (broader than the title implies).

Code Quality

Consensus across all three reviewers: the implementation is clean and correct. It uses an existing theme token via useEmotionTheme() (theme.colors.bgColor), which aligns with the theming guidance in frontend/AGENTS.md, and the change is localized to the BaseWeb override path.

Two cross-cutting observations (raised by claude-opus-4-8-thinking-xhigh, not disputed by the others):

  • Symptom vs. root cause. The underlying defect is in createBaseUiTheme.ts where menuFill = inSidebar ? colors.secondaryBg : colors.bgColor. Since createSidebarTheme already sets colors.bgColor to the sidebar's backgroundColor, the "unswap" reasoning behind that menuFill branch is stale, which is what mis-resolves the surface. The per-component override is a defensible low-risk choice for a targeted bugfix, but the same latent bug still affects other sidebar popovers that rely on menuFill (e.g. the TimeInput dropdown and the date-picker calendar). A central fix in createBaseUiTheme.ts (removing the stale swap) would fix those too and let the per-component overrides be dropped — worth a follow-up, or at minimum a code note pointing at createBaseUiTheme.ts so the two don't drift.
  • Duplication. The 4-line comment plus the backgroundColor line are duplicated verbatim across the two render branches (empty-state and populated). Left as an inline comment.

Test Coverage

This is the main point of disagreement. claude-opus-4-8-thinking-xhigh and gpt-5.4-xhigh both consider a targeted regression test required before merge; gemini-3.1-pro considers the existing suites sufficient for a pure CSS override.

Resolving the conflict: the changes ship with no new tests. VirtualDropdown.test.tsx covers empty/populated/scroll/creatable behavior but asserts nothing about the list background, and there is no e2e case that opens a sidebar selectbox/multiselect under custom [theme.sidebar] colors. Because this is a user-visible regression tied to theme scoping through a portalled popover, the exact bug can silently return with zero test signal. Streamlit's own review checklist and AGENTS.md testing strategy expect user-facing fixes to be covered. Critically, there is a ready-made, low-cost spot: e2e_playwright/theming/sidebar_custom_theme_test.py already configures the exact repro (STREAMLIT_THEME_SIDEBAR_BACKGROUND_COLOR + STREAMLIT_THEME_SIDEBAR_SECONDARY_BACKGROUND_COLOR), and theme_tester_app.py's sidebar currently has no multiselect. On balance, a regression test is warranted, so I side with the majority: this is the one merge-blocking gap.

A cheap frontend assertion (toHaveStyle({ backgroundColor: ... }) on stSelectboxVirtualDropdown / stSelectboxVirtualDropdownEmpty under a sidebar-scoped theme) plus the e2e snapshot would fully close the gap.

Backwards Compatibility

No API, protobuf, or backend changes — all reviewers agree compatibility risk is low. One user-visible nuance flagged by claude-opus-4-8-thinking-xhigh and worth confirming: the fix also changes the default (uncustomized) sidebar dropdown background, since old menuFill = colors.secondaryBg and new = colors.bgColor differ even without custom colors (e.g. dark theme shifts the sidebar dropdown from #0e1117 to #262730). This is arguably more consistent (dropdown = region background, mirroring the main pane), but it is broader than "only the both-colors-configured case" and is currently uncovered by any snapshot. Please confirm it's intended and lock it with a snapshot. Main-area dropdowns are unchanged.

Security & Risk

Unanimous: no security-relevant surface is touched. No server/websocket/auth/session/cookie/XSRF/CORS/CSP code, no asset serving or path handling, no postMessage/iframe handling, no runtime JS execution, and no new dependencies. Regression risk is limited to sidebar dropdown appearance (see Backwards Compatibility).

External test recommendation

  • Recommend external_test: No
  • Triggered categories: None
  • Evidence: frontend/lib/src/components/shared/Dropdown/VirtualDropdown.tsx is the only change — a StyledList background override to theme.colors.bgColor in the populated and empty branches. No routing, auth, websocket, embedding, asset-serving, storage, or security-header behavior is affected.
  • Suggested external test focus areas: None applicable; standard local regression coverage (see Test Coverage) is sufficient.
  • Confidence: High (all three reviewers concur)
  • Assumptions and gaps: Purely client-side, theme-derived styling. Rendering does not depend on hosting origin, proxying, or embedding, so externally hosted/embedded behavior would not diverge from local runs.

Accessibility

No a11y regressions: keyboard, focus, roles, and labels are untouched — only a surface color changes. One thing worth verifying visually (theme-dependent, non-blocking): option text uses bodyText/fadedText60, so moving the dropdown onto the sidebar backgroundColor (vs. secondaryBackgroundColor) could alter text/background contrast for some custom themes. A snapshot in the custom-theme e2e would double as a de-facto contrast check.

Readability

Code-comment findings (the "goldenrod"/#11348 phrasing and the verbatim duplication across both branches) are captured as inline comments and not repeated here.

PR title — All three reviewers note the title says "Multiselect" but the fix also covers st.selectbox (shared VirtualDropdown), so it understates scope. Suggested tightening: [bugfix] Fix sidebar select/multiselect dropdown background color (#11348).

PR description — The description is thorough and well-structured (root cause, repro, fix, verification), but two reviewers note it buries the reviewer-facing change under implementation mechanics; a shorter lead would communicate the change faster. Additionally, it claims "main-area dropdown unchanged" without mentioning that the fix also changes the default (uncustomized) sidebar dropdown background. Add a one-line caveat, e.g.: "Note: this also changes the default sidebar dropdown background from the app backgroundColor to the sidebar's backgroundColor, since BaseWeb's menuFill previously resolved to the sidebar secondaryBackgroundColor."

Recommendations

  1. Add a regression test (merge-blocker). Preferably extend e2e_playwright/theming/sidebar_custom_theme_test.py + theme_tester_app.py to render an st.multiselect/st.selectbox in the sidebar, open it, and snapshot the dropdown. Optionally add a VirtualDropdown.test.tsx toHaveStyle assertion for the StyledList background.
  2. Confirm the default-theme visual change is intended and add the caveat to the PR description.
  3. Consider a follow-up that fixes menuFill centrally in createBaseUiTheme.ts (removing the stale "swap" reasoning) so TimeInput/date-picker sidebar popovers get the same fix and the per-component override can be dropped.
  4. Address the inline nits: de-duplicate the shared list style and trim the issue-specific ("goldenrod") comment.
  5. Tighten the PR title to reflect the shared selectbox/multiselect scope.

Verdict

CHANGES REQUESTED: The fix is correct, minimal, and low-risk, but this user-facing regression fix (which also shifts the default sidebar dropdown appearance) ships with no unit or e2e coverage despite a ready-made e2e location that already reproduces the exact configuration — add a regression test before merge. The remaining items (title/description tightening, comment/duplication nits, central menuFill follow-up) are non-blocking.


This is an automated AI review consolidated by claude-opus-4-8-thinking-xhigh from reviews by gpt-5.4-xhigh, gemini-3.1-pro, and claude-opus-4-8-thinking-xhigh. All three expected reviews were completed. Please verify the feedback and use your judgment.

This review also includes 2 inline comment(s) on specific code lines.

// `menuFill`, which resolves to the sidebar's
// `secondaryBackgroundColor` when both sidebar bg colors are
// configured — causing the goldenrod dropdown in #11348.
backgroundColor: theme.colors.bgColor,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: This backgroundColor override and its 4-line comment are duplicated verbatim in the empty-state branch (line 119). Hoist a shared style object (e.g. a module-level LIST_STYLE_OVERRIDES or a small helper that takes theme) so the override and its explanation live in one place and the two branches can't drift.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f115932: hoisted the override into a shared menuFillOverride local; both branches now spread it so the two can't drift.

// one on the popover, so we need to remove it here.
boxShadow: "none",
overflow: "hidden",
// Match the current region's background instead of BaseWeb's

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The issue-specific history ("goldenrod", #11348) isn't needed to understand the intent. Consider trimming to the rule/intent, keeping the public issue reference at the end. This applies to the duplicated comment at line 188 as well.

// Match this region's own background. BaseWeb's `menuFill` resolves to
// the sidebar's `secondaryBackgroundColor` (not its `backgroundColor`)
// when both sidebar colors are set, giving the wrong surface. See #11348.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f115932: trimmed the comment per suggestion (dropped the goldenrod/history phrasing) and hoisted the override + rationale into a single shared menuFillOverride at the top of the component so the two branches share one explanation.

@github-actions github-actions Bot added the do-not-merge PR is blocked from merging label Jul 27, 2026
BaseWeb's `menuFill` resolves to `secondaryBg` inside the sidebar
(see `createBaseUiTheme.ts` — `mainPaneBgColor = inSidebar ? secondaryBg : bgColor`).
The intent was to "unswap" the sidebar's default bg/secondaryBg flip,
but when the user explicitly configures both `[theme.sidebar]`
`backgroundColor` and `secondaryBackgroundColor`, this fallback paints
the dropdown list with the sidebar's `secondaryBackgroundColor`
instead of its `backgroundColor`.

Override the `StyledList` background in `VirtualDropdown` with
`theme.colors.bgColor` so the list surface always matches the region's
own background. The sidebar-scoped emotion theme resolves `bgColor` to
the sidebar's configured `backgroundColor`, keeping the main-body
dropdown unchanged.
@sfc-gh-dbyttow
sfc-gh-dbyttow force-pushed the bugfix/issue-11348-sidebar-multiselect-bg branch from 6d16d69 to 0cc3dac Compare July 27, 2026 13:45
@sfc-gh-dbyttow

Copy link
Copy Markdown
Contributor Author

Follow-up on the second AI review pass (which flipped to CHANGES_REQUESTED on the missing regression test):

  • Comment de-dup + wording nits (line 115, line 192) — fixed in f115932e0a: hoisted the override into a shared menuFillOverride local and trimmed the comment (removed the "goldenrod"/history phrasing).
  • Regression test (merge-blocker item) — declining. st.multiselect is being migrated off BaseWeb to React Aria Components in Remove BaseWeb from Multiselect #16175, which deletes VirtualDropdown.tsx outright as dead code. Adding an e2e/unit test scoped to a file that is about to be removed produces zero durable regression signal. The migration is where the real coverage for sidebar-scoped dropdown backgrounds should land (RAC uses a completely different popover surface, so the BaseWeb menuFill failure mode does not exist there). Filing sidebar-scoped dropdown coverage against Remove BaseWeb from Multiselect #16175 makes more sense than backfilling here.
  • Central menuFill fix in createBaseUiTheme.ts — declining as follow-up. Same rationale: the BaseWeb theme is going away for the affected widgets.
  • Default sidebar dropdown bg caveat — worth noting, and the AI is right that the default sidebar dropdown bg also shifts from secondaryBackgroundColorbackgroundColor. That change is intentional and, per the AI reviewer itself, "more consistent (dropdown = region background, mirroring the main pane)". Not adding it to the PR body since Remove BaseWeb from Multiselect #16175 supersedes this file entirely.
  • PR title — leaving as-is. st.selectbox already migrated off VirtualDropdown in a prior PR (it consumes react-aria-components directly), so only st.multiselect actually goes through the code path this fix touches — the title accurately reflects the change surface.

@sfc-gh-dbyttow sfc-gh-dbyttow added the ai-review If applied to PR or issue will run AI review workflow label Jul 27, 2026
@github-actions github-actions Bot removed the ai-review If applied to PR or issue will run AI review workflow label Jul 27, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Fixes the multiselect dropdown background color in the sidebar when both [theme.sidebar] backgroundColor and secondaryBackgroundColor are explicitly configured. The fix adds an explicit backgroundColor: theme.colors.bgColor override to the StyledList in VirtualDropdown, bypassing BaseWeb's menuFill which incorrectly resolves to secondaryBg in that scenario.

Only one file is changed: frontend/lib/src/components/shared/Dropdown/VirtualDropdown.tsx (+7 lines).

Reviewer agreement: Both reviewers (claude-4.6-opus-high-thinking, gpt-5.3-codex-high) approved unanimously with no critical findings.

Code Quality

The implementation is well-structured and follows established patterns:

  • A shared menuFillOverride variable avoids duplication across the two StyledList render paths (empty state and populated list).
  • Uses the standard BaseWeb $style override pattern, consistent with other overrides in the codebase.
  • Uses theme.colors.bgColor from the emotion theme, which is the recommended approach per frontend/AGENTS.md.
  • The variable is correctly scoped inside the component body since it depends on theme from useEmotionTheme().

Both reviewers agreed the code quality is good with no structural or maintainability concerns.

Test Coverage

No new tests are included. Both reviewers found this acceptable given:

  1. The fix is a pure CSS override with no logic change.
  2. Testing computed CSS in unit tests is brittle and low-value.
  3. The scenario requires a custom sidebar theme configuration that's hard to replicate in vitest.
  4. Existing tests (57/57) continue to pass.

Minor disagreement: GPT-5.3 more explicitly recommends adding a focused unit test asserting dropdown background in sidebar-themed context. Claude-4.6 considers this purely optional follow-up. Both agree it is not a merge blocker.

Backwards Compatibility

No breaking changes. In the default case (no explicit sidebar theme colors), theme.colors.bgColor resolves to the same value that menuFill would have produced. The override only corrects behavior when both sidebar colors are explicitly configured—a case that was previously broken. Both reviewers agree.

Security & Risk

No security concerns. Both reviewers confirmed:

  • No network, auth, or data handling changes.
  • No new dependencies.
  • No DOM manipulation or script execution.
  • Low regression risk: the override is scoped to VirtualDropdown's StyledList only.

External test recommendation

  • Recommend external_test: No
  • Triggered categories: None
  • Evidence:
    • frontend/lib/src/components/shared/Dropdown/VirtualDropdown.tsx: CSS-only background color override, no network/auth/embedding/routing changes.
    • No changes in routing, auth/cookies/CSRF, websocket/session transport, embedding boundary logic, asset serving, service worker, storage, SiS runtime, or security headers.
  • Suggested external_test focus areas: N/A
  • Confidence: High
  • Assumptions and gaps: None — change is fully contained in a frontend styling override with no external-facing behavior changes.

Both reviewers agreed on this assessment.

Accessibility

No accessibility impact. The change modifies only the backgroundColor CSS property on the dropdown list container. It does not alter ARIA attributes, focus management, keyboard navigation, or screen reader behavior. The fix likely improves contrast by restoring the intended background color. Both reviewers agree.

Readability

File: frontend/lib/src/components/shared/Dropdown/VirtualDropdown.tsx

The comment above menuFillOverride is clear and actionable — it explains why the override exists (BaseWeb's menuFill misbehaves with sidebar colors), not just what it does. The reference to issue #11348 is appropriate. No rewrites needed. Both reviewers agree.

PR title/description: Minor disagreement — Claude found the title and description well-structured with no rewrites needed. GPT suggested a slightly shorter description structure. The current title and description are adequate and technically accurate; no rewrite is required for merge.

Recommendations

  1. Optional (follow-up PR): Consider an E2E screenshot test that configures custom sidebar theme colors and validates the multiselect dropdown's visual appearance.
  2. Optional (follow-up PR): Consider adding a focused unit test in VirtualDropdown.test.tsx asserting dropdown background selection in sidebar-themed context.
  3. Optional (follow-up PR): The root cause in createBaseUiTheme.ts could be fixed at the source so that mainPaneBgColor correctly handles explicitly configured sidebar secondary colors, preventing similar issues in other BaseWeb components.

None of these are merge blockers.

Verdict

APPROVED: A minimal, well-targeted CSS fix that corrects a visual regression in sidebar multiselect dropdowns. The change is low-risk, backwards compatible, and follows established theming patterns. Both reviewers approved unanimously.

Model Verdict Notes
claude-4.6-opus-high-thinking APPROVED No blocking issues
gpt-5.3-codex-high APPROVED No blocking issues

Consolidated review by claude-4.6-opus-high-thinking. This is an automated AI review. Please verify the feedback and use your judgment.

@github-actions github-actions Bot removed the do-not-merge PR is blocked from merging label Jul 27, 2026
@sfc-gh-dbyttow
sfc-gh-dbyttow enabled auto-merge (squash) July 27, 2026 19:30
@sfc-gh-dbyttow
sfc-gh-dbyttow merged commit 96458ec into develop Jul 27, 2026
63 of 66 checks passed
@sfc-gh-dbyttow
sfc-gh-dbyttow deleted the bugfix/issue-11348-sidebar-multiselect-bg branch July 27, 2026 19:31
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiselect drop down background is inconsistent

3 participants