Skip to content

Sheet tabs: right-clicking a tab activates its sheet - #1223

Merged
aiongg merged 1 commit into
storytold:mainfrom
richard1912:fix/tab-right-click-activates
Oct 22, 2026
Merged

aiongg merged 1 commit into
storytold:mainfrom
richard1912:fix/tab-right-click-activates

Conversation

@richard1912

Copy link
Copy Markdown
Contributor

Summary

Right-clicking a sheet tab opens the tab menu but leaves the previously active sheet active. Excel activates the tab you right-click. This matters because some menu items act on the active sheet, not the clicked one:

  • Protect Sheet… / Unprotect Sheet… reads and changes the active sheet. Right-click a protected tab while an unprotected sheet is active and the menu offers "Protect Sheet…", which then protects the other sheet.
  • Select All Sheets and anything else in the menu that uses the active sheet has the same mismatch.

Insert Sheet, Delete, Rename, Move or Copy, Duplicate, Tab Color and Hide already take the clicked tab's index, so they were fine.

Repro (0.6.1 and main 84acf62)

  1. Make a workbook with sheets Data and Reference, and protect Reference.
  2. With Data active, right-click the Reference tab.
  3. The menu says "Protect Sheet…" and Data stays active. Excel switches to Reference and offers "Unprotect Sheet…".

Change

crates/ui-egui/src/tabs.rs, sheet_tabs: a secondary click on an inactive tab activates its sheet (through the existing activate_sheet, so an open edit is committed first and point mode keeps working), before the menu reads the active sheet.

Tests

  • right_clicking_a_tab_activates_its_sheet_so_the_menu_acts_on_it in crates/ui-egui/tests/sheet_tabs.rs: right-clicks an inactive protected tab and checks it becomes active and the menu offers "Unprotect Sheet…". It fails on main and passes here.
  • cargo xtask ci: fmt, clippy, test, assets, layers and wasm pass. parity fails the same way on unmodified main on Windows (line endings in the regenerated checklist).

Found while testing #1222 (padlock on protected tabs).

As in Excel, a right-click on an inactive tab now activates that sheet, so
the tab menu's Protect/Unprotect Sheet and Select All Sheets act on the
sheet that was clicked rather than the one that was active.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A2bJ3LxrZ6YnmppgrfwHwr
@aiongg
aiongg merged commit 2cbd39c into storytold:main Oct 22, 2026
1 check passed
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