Tk Source Code

View Ticket
Login
Ticket UUID: 4e7fbe8b4a6c88a84019815cb1d0b316335f5c42
Title: X11: menus taller than the screen cannot be scrolled
Type: RFE Version: 8.6.18, 9.0.5, 9.1b1
Submitter: serhiy.storchaka Created on: 2026-09-29 20:51:17
Subsystem: 12. Unix Menus Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-09-30 20:44:39
Resolution: Accepted Closed By: nemethi
    Closed on: 2026-09-30 20:44:39
Description:

On X11 a menu taller than the screen is posted partly off screen, and the entries beyond the screen edge cannot be reached with the mouse or seen when activated with the keyboard. Native menus on Windows and macOS, and menus in GTK and Qt, are limited to the screen height and can be scrolled with arrows at the top and bottom or with the mouse wheel.

menu .m -tearoff 0
for {set i 0} {$i < 200} {incr i} {
    .m add command -label "Item $i"
}
tk_popup .m 100 100

This was reported in [219989] (1999), which was closed as a duplicate of a bug in the old tracker.

It is also the only case where a menu posted from a menubar or a menubutton still has to cover its button and the pointer. A menu which fits on the screen can be posted below or above it ([470331], [680660], [f9d316a5e0]).

User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-09-30 20:44:39:

Many thanks, Serhiy! Merged to main (only, because of the new yview subcommand) by commit [0f866663].


serhiy.storchaka added on 2026-09-30 09:52:13:

Proposed implementation in branch menu-scroll, on top of the fix for [470331] (branch menu-post-under-pointer).

On X11, a menu taller than the screen is limited to the screen height. It gets scroll arrows at the top and bottom, like in GTK and Win32.

  • Holding the pointer over an arrow scrolls the menu continuously; the mouse wheel scrolls it as well.
  • Activating an entry, including by keyboard navigation, scrolls it into view.
  • A new "yview" subcommand lets scripts query and change the scroll position, like "yview" in other widgets. It supports "moveto" and "scroll N units|pages".

Windows and macOS are unchanged, because their native menus already scroll. The documentation and tests are included.

Menus wider than the screen are not changed. They are less common, and the current behavior is acceptable for them.

The behavior can be tested in the widget demo "Popup (context) menus": select "Larger than the screen" for the menu height, then right-click in the gray area.