Skip to content

ux: Implement vertical scrolling for dropdown menus - #5165

Open
tuffnatty wants to merge 1 commit into
MidnightCommander:masterfrom
tuffnatty:dropdown-scroll
Open

tuffnatty wants to merge 1 commit into
MidnightCommander:masterfrom
tuffnatty:dropdown-scroll

Conversation

@tuffnatty

Copy link
Copy Markdown
Contributor

Proposed changes

When a dropdown menu does not fit on the screen, let it scroll to always show the currently selected item.

I believe this gives an immediate UX improvement, regardless of any strategic menu system reorganizations.

Checklist

  • I have referenced the issue(s) resolved by this PR (if any)
  • I have signed-off my contribution with git commit --amend -s
  • Lint and unit tests pass locally with my changes (make indent && make check)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added the necessary documentation (if appropriate)

@github-actions github-actions Bot added the needs triage Needs triage by maintainers label Sep 26, 2026
@github-actions github-actions Bot added this to the Future Releases milestone Sep 26, 2026
@github-actions github-actions Bot added the prio: medium Has the potential to affect progress label Sep 26, 2026
Comment thread lib/widget/menu.c
Comment thread lib/widget/menu.c
Comment thread lib/widget/menu.c Outdated
@tuffnatty

Copy link
Copy Markdown
Contributor Author

Updated with @mc-worker 's suggestions.

@zyv zyv added area: core Issues not related to a specific subsystem and removed needs triage Needs triage by maintainers labels Sep 29, 2026
@WBienePeC

Copy link
Copy Markdown

That's a good suggestion. But... :)
Keyboard navigation within the menu items works, as does the subsequent activation of the selected menu item.
However, the menu item selected with the mouse does not correspond to the desired function. Instead, a menu item is activated that is shifted relative to the original menu list.
Thanks, Wolfgang

@tuffnatty

Copy link
Copy Markdown
Contributor Author

@WBienePeC Thanks Wolfgang! I've tried to fix mouse clicks and some visual glitches. Let me know if that helps.

@WBienePeC

Copy link
Copy Markdown

I tested your changes and, unfortunately, have to say;
it’s not working yet.

But I noticed something new—without the changes.
Your efforts are being negated (limited) in many places.
Fundamentally, the menu behavior is very different.
For example: If the mouse pointer is inside the widget on a
divider line or at the edges of the widget, then the mouse’s scroll function has no effect on the active menu bar of the list.
To me, that doesn’t make any sense.
On the other hand, if you move the mouse pointer back to an actual entry and then use the mouse’s scroll function, the corresponding item is selected.

Scrolling with the mouse is also possible along the edges within a file list.

Maybe this is all by design.

I hope this helps you.
Good luck
Wolfgang

Comment thread lib/widget/menu.c
Comment thread lib/widget/menu.c
Comment thread lib/widget/menu.c Outdated
Comment thread lib/widget/menu.c Outdated
@tuffnatty

tuffnatty commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

@mc-worker I've updated the code with your suggested changes.
@WBienePeC Well, I usually have mouse reporting off in my terminal and use the mouse only for text selection. I've switched mouse reporting on, fixed the incorrect command on click, and tried to scroll the menus using the mouse and keyboard, and I think I have not introduced any new bad behaviour. Non-action of the mouse wheel when then pointer is on a menu separator looks truly weird, but is out of the scope of this PR and probably deserves a separate issue.

@WBienePeC

Copy link
Copy Markdown

@tuffnatty I tested your latest changes and unfortunately have to say;
selecting with the mouse still doesn't work.

Well, I looked through the code and found a spot where I
changed the code, as shown in the following image.

Bildschirmfoto_2026-10-08_15-50-18

With this change, the following comparison makes sense, and
selecting with the mouse works perfectly.

I’d like to ask you to merge my small change with yours.
I don’t yet have the necessary knowledge to do that myself.

The mouse scroll function should indeed be handled separately.

I hope this helps you.
Best of luck
Wolfgang

Signed-off-by: Phil Krylov <phil@krylov.eu>
@tuffnatty

Copy link
Copy Markdown
Contributor Author

@WBienePeC Thanks Wolfgang, your finding was of great help. I've added your change to the code, and it seems non-scrolling when the mouse is over a separator line has also disappeared.

@WBienePeC

Copy link
Copy Markdown

Thank you very much for implementing the code. The mouse selection issue is now resolved. :)
It really works. :)

But...
With the code change shown in the following image:

Bildschirmfoto_2026-10-08_23-26-47

the mouse's scroll function will affect the focus of the menu items regardless of the mouse pointer's position,
except for the first line of “MC,” the mouse's scroll function will affect the focus of the menu items.

This is just a suggestion...

I'll start a discussion shortly about
“The functions of the mouse at position XY(Z) within MC.”
The title could be “MC and Mouse.” :)

Wolfgang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Issues not related to a specific subsystem prio: medium Has the potential to affect progress

Development

Successfully merging this pull request may close these issues.

4 participants