Skip to content

🎨 Palette: Defers content rendering by preventing selectbox auto-selection - #79

Open
Gunnarguy wants to merge 1 commit into
mainfrom
ux-improvement-selectbox-index-7679457265568836288
Open

Gunnarguy wants to merge 1 commit into
mainfrom
ux-improvement-selectbox-index-7679457265568836288

Conversation

@Gunnarguy

@Gunnarguy Gunnarguy commented Jul 28, 2026

Copy link
Copy Markdown
Owner

🎨 Palette: Defers content rendering by preventing selectbox auto-selection

💡 What:
Added index=None, placeholder, and help tooltips to interactive Streamlit selection components (st.selectbox, st.multiselect) across the Meta Database views (Unit Details, Builds, Content Teams). Enclosed the detail rendering logic in conditionals (e.g. if pick:) so they only evaluate after an explicit choice is made.

🎯 Why:
Streamlit select boxes default to index=0 (selecting the first option automatically). This meant as soon as the user opened a tab (like Builds), the details for the first character in the database would abruptly render, creating significant visual noise and cognitive load. Setting index=None creates a much cleaner, empty default state, prompting the user with a placeholder before rendering anything.

📸 Before/After:
Before, the UI showed all details immediately. After, it remains clean until an explicit user action occurs.

♿ Accessibility:
Added native help tooltips explaining the purpose of each control, improving general usability.


PR created automatically by Jules for task 7679457265568836288 started by @Gunnarguy

Summary by Sourcery

Defer rendering of meta database detail panels until a user explicitly selects a value in Streamlit selection controls.

New Features:

  • Add placeholders and contextual help tooltips to unit, build, and content selection widgets in the meta database views.

Enhancements:

  • Initialize Streamlit selectboxes with no default selection and gate detail rendering behind selection checks to keep initial views empty and reduce visual noise.
  • Document the selectbox auto-selection behavior and the adopted pattern for preventing premature content rendering in the Palette guidelines.

…tion

Co-authored-by: Gunnarguy <110250624+Gunnarguy@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 28, 2026 08:15
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@sourcery-ai

sourcery-ai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Reviewer's Guide

Defers rendering of meta database detail panels until a user makes an explicit selection, by adding placeholders and help text to Streamlit selection widgets and gating detail rendering on non-empty selections, plus documenting the pattern in the Palette guide.

Sequence diagram for deferred detail rendering in meta database views

sequenceDiagram
    actor User
    participant StreamlitApp
    participant Selectbox
    participant DetailPanel

    StreamlitApp->>Selectbox: st.selectbox(index=None, placeholder, help)
    StreamlitApp->>Selectbox: st.multiselect(placeholder, help)

    User->>Selectbox: select item
    Selectbox-->>StreamlitApp: selection

    alt [selection is not empty]
        StreamlitApp->>DetailPanel: st.columns
        StreamlitApp->>DetailPanel: st.markdown unit_details
        StreamlitApp->>DetailPanel: st.write unit_attributes
    else [no selection]
        StreamlitApp->>DetailPanel: [skip detail rendering]
    end
Loading

File-Level Changes

Change Details Files
Make unit filters and detail panel render only after explicit unit selection.
  • Added placeholders and help tooltips to Attribute/Class/Job Type multiselect filters.
  • Set the unit inspection selectbox to start with no selection (index=None) and show a descriptive placeholder.
  • Wrapped the unit detail rendering block in a conditional so hero details are only computed and displayed when a unit has been chosen.
src/grandchase_meta_analyzer/explorer_app.py
Defer builds view rendering until a hero is explicitly selected.
  • Updated the builds hero selectbox to use index=None with a descriptive placeholder and help text.
  • Guarded the builds iteration/rendering loop with a conditional so no builds are shown until a hero is selected.
src/grandchase_meta_analyzer/explorer_app.py
Defer content teams rendering until a content mode is explicitly selected.
  • Changed the content selectbox to use index=None and added placeholder and help tooltip.
  • Wrapped the content team rendering logic in a conditional so phases/teams are only rendered once a content selection is made.
src/grandchase_meta_analyzer/explorer_app.py
Document the selectbox empty-state and deferred-rendering pattern in the Palette guide.
  • Added a new Palette entry describing Streamlit's default index=0 behavior for selectboxes.
  • Documented the pattern of using index=None plus conditional rendering to keep initial UIs clean.
.Jules/palette.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The hero/chaser trait rendering logic is now duplicated in multiple places (unit inspector, builds tab); consider extracting a small helper to build the trait strings so future changes to formatting or limits only need to be made once.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The hero/chaser trait rendering logic is now duplicated in multiple places (unit inspector, builds tab); consider extracting a small helper to build the trait strings so future changes to formatting or limits only need to be made once.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copilot AI left a comment

Copy link
Copy Markdown

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 Meta Database UI in explorer_app.py to prevent Streamlit selection widgets from auto-selecting the first option and to defer rendering of detail panels until the user makes an explicit selection, reducing initial visual noise.

Changes:

  • Added index=None, placeholder, and help tooltips to key st.selectbox widgets (Unit Details, Builds, Content Teams).
  • Added conditional gating (if ...) around detail rendering so panels only render after a selection is made.
  • Documented the “prevent auto-selection” pattern in .Jules/palette.md.

Reviewed changes

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

File Description
src/grandchase_meta_analyzer/explorer_app.py Adds placeholders/help + defers rendering of unit/build/content detail panels until an explicit selection is made.
.Jules/palette.md Documents the selectbox index=None pattern for preventing premature UI rendering.
Comments suppressed due to low confidence (2)

src/grandchase_meta_analyzer/explorer_app.py:3726

  • Same issue as Unit Roster: because meta tables are loaded with .fillna(""), the hero option can be "". Using if build_hero: will skip rendering even after the user explicitly selects that value. Use an explicit None check to gate rendering only on the placeholder state.
            if build_hero:

src/grandchase_meta_analyzer/explorer_app.py:3798

  • Same truthiness pitfall: index=None yields None for the placeholder, but an explicit selection can still be "" due to .fillna("") on loaded tables. if content_pick: will incorrectly skip rendering for that explicit selection; prefer is not None so only the placeholder state is gated.
            if content_pick:

st.write(f"Main: {tc1} → T3: {tt1}, T6: {tt2}")
else:
st.write("—")
if pick:
Comment thread .Jules/palette.md
**Action:** Utilize built-in visual aids via Streamlit's native Material Symbols shortcodes (e.g. `icon=":material/search:"` for search, `icon=":material/menu_book:"` for database views). This improves UX and ensures pixel-perfect, cross-browser compatibility across Safari and Chrome without needing custom CSS.
## 2025-02-12 - Prevent Auto-Selection in Streamlit Selectboxes
**Learning:** Streamlit's `st.selectbox` defaults to selecting the first item (`index=0`), which can prematurely clutter the UI with detailed panels before the user has made an explicit choice.
**Action:** When adding placeholders to `st.selectbox`, explicitly set `index=None` to ensure the placeholder is visible and the input starts empty. Pair this with a conditional block (e.g., `if selection:`) to defer rendering detailed information panels until an item is actively chosen, keeping the initial UI clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants