Skip to content

Fix item context menus after scrolling directory views - #201

Closed
tcraid0 wants to merge 1 commit into
thisisgm:mainfrom
tcraid0:fix/scrolled-context-menu
Closed

tcraid0 wants to merge 1 commit into
thisisgm:mainfrom
tcraid0:fix/scrolled-context-menu

Conversation

@tcraid0

@tcraid0 tcraid0 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Right-clicking the final files in a shortened, scrolled window can replace their item menu with the directory background menu (#195).

The background TapHandlers in List, GridArea and ColumnPane live under the view's contentItem. Their local event positions already include the scroll displacement; adding contentX/contentY again makes indexAt miss the clicked delegate. Both item and background handlers receive the tap, so the background menu replaces the item menu.

Map eventPoint.scenePosition into contentItem before indexAt in those three handlers. This preserves the existing delegate lookup, model virtualization, selection handling and menu placement. The new scrolledmenu native case is registered in the default UI runner.

Reproduction: use 20 disposable files, compact density and 14px text; start at 900×900, shrink to 900×400, scroll to the end, and right-click the final file. Repeat in list, columns and grid. On ffa7566 the final click opens the background menu; with this change it opens the item menu. Real empty space continues to open the background menu.

Validation on Omarchy 4.0.4 / Hyprland 0.56.2 / Qt 6.11.2 / Quickshell 0.3.1:

  • Native regression: 30 menu assertions passed, covering first/final items, empty tails, empty directories, shrinking and growing in all three views. The unmodified base fails on the final item after scrolling in each view.
  • Additional native checks: 500-file virtualization, filtered backend/view indices, selection inside/outside the selected set, both dual panes, final folders, a partially clipped final row, Settings right-click blocking, and item-menu Open both in a fresh fixture window and after Settings.
  • Debug and release Rust tests: 842 passed in each profile; both builds and test builds emitted no warnings. QML lint gate: zero regressions. Shell syntax and diff whitespace checks passed.
  • tests/run-all.sh: 22 of 29 suites passed. The other seven fail on the unmodified base too: missing expect (gio-auth), missing media fixtures (protocol, thumbs, thumbs-exec, media), trash/undo assertions (ops), and kill-window timing assertions (uistate). These failures remain unresolved.

The machine lacks omarchy-drive. The regression case body was executed against actual Flea windows using a temporary evdev/wtype adapter and existing read-only IPC; the complete official tests/ui.sh harness was not run. No other Qt versions or compositors were tested.

Related: #195

Summary by CodeRabbit

  • Bug Fixes
    • Right-clicking in scrolled list, column, and grid views now opens the appropriate menu for the clicked item or empty background. Clicks in the blank space below the last visible row are handled correctly, and resizing the window no longer causes clicks to target the wrong row. These improvements also apply when right-clicking in an empty directory.

@coderabbitai

coderabbitai Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 0e97b935-003d-4b99-a4cc-9b7d9ae3b959

📥 Commits

Reviewing files that changed from the base of the PR and between ffa7566 and 03ee633.

📒 Files selected for processing (5)
  • tests/ui-scrolled-menu.sh
  • tests/ui.sh
  • ui/ColumnPane.qml
  • ui/GridArea.qml
  • ui/List.qml

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

List, column, and grid background right-click handlers now map scene positions to content coordinates before checking for a row. A new UI test checks menu state for row and empty-space clicks at multiple window heights and runs by default.

Changes

Scrolled background menus

Layer / File(s) Summary
Map background clicks to content coordinates
ui/List.qml, ui/ColumnPane.qml, ui/GridArea.qml
Each handler maps the click’s scene position to content-item coordinates before calling indexAt.
Test scrolled menu behavior
tests/ui-scrolled-menu.sh, tests/ui.sh
The UI test checks row and empty-space menus in list, column, and grid views at window heights 900, 400, and 900. The default test runner includes the test case.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: thisisgm

Merge Risk: ⚪ Minimal · up to 03ee6

The changed handlers and UI test support the intended item-versus-background menu behavior. No issue identified here needs to be fixed before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (3 skipped: 3… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing item context menus after scrolling in directory views.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thisisgm

Copy link
Copy Markdown
Owner

Fixed in 359912eb (v0.3.5), where List, Grid, Columns and Trash stop adding the scroll offset a second time before indexAt, the same root cause this PR found, so a right click on a scrolled row opens that row's menu.

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