Skip to content

fix(pbtop): focus the first chart panel on a fresh start - #1875

Merged
igorjs merged 1 commit into
mainfrom
fix/pbtop-charts-initial-focus
Nov 19, 2026
Merged

igorjs merged 1 commit into
mainfrom
fix/pbtop-charts-initial-focus

Conversation

@igorjs

@igorjs igorjs commented Nov 19, 2026

Copy link
Copy Markdown
Member

Summary

On a fresh install pbtop opened on the Charts tab with the focus on the spend.daily table, so the first screen highlighted a table instead of a chart.

Cause: App::new sets the focus to Models. The default Charts tab has no Models panel, so fix_focus fell back to the first slot, spend.daily. The saved screen setup holds a tab but no focus, so a fresh start and a saved start both went through that fallback.

Change: the fallback now picks the first focusable slot that draws a chart (Tokens on the default layout, since the burn-up takes no focus), and the first slot when the tab has none. A saved tab still wins, and a focus already on a shown panel is kept. The chart test is now one helper, draws_chart, shared with chart_slot.

The pbtop pictures start their tab through go_tab, as the app does, so they show the real first screen. They are regenerated and hold no @ or email.

Notes for reviewers

  • New: a fresh start with an empty temp home on the default layout focuses Tokens, a chart slot.
  • New: a tab of only tables still focuses its first panel.
  • Updated two tests that assumed the old fallback.
  • cargo test -p playbook-telemetry with UPDATE_SNAPSHOTS=1 regenerated the docs SVGs; cargo clippy -p playbook-telemetry --all-targets -- -D warnings is clean.

A fresh start kept the focus on Models, which the Charts tab does not
show, so fix_focus fell back to its first slot: the spend.daily table.
Fall back to the first focusable slot that draws a chart instead, and
to the first slot when the tab has none. Screenshots now start the
tab the way the app does.

Signed-off-by: igorjs <2278164+igorjs@users.noreply.github.com>
@igorjs
igorjs marked this pull request as ready for review November 19, 2026 09:00
@igorjs
igorjs enabled auto-merge November 19, 2026 09:00
@igorjs
igorjs added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 4b1ec42 Nov 19, 2026
46 checks passed
@igorjs
igorjs deleted the fix/pbtop-charts-initial-focus branch November 19, 2026 09:08
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.

1 participant