Skip to content

lib/ui: combobox dropdown items cannot be selected by mouse — dispatch closes dropdowns before hit-testing the click #577

Description

@InauguralPhysicist

Surfaced by DeslanStudio milestone 4e (scale/key/preset pickers).

ui.dispatch's mousedown path runs _close_dropdowns of root FIRST — before _hit_test (lib/ui.eigs, "Close any open dropdowns first"). So when a combobox is open and the user clicks an item in its dropdown, the dropdown is closed before the hit test runs; the click lands on whatever sits underneath. _hit_test_combobox does extend the widget's bounds while open == 1, but by then open is already 0. Keyboard selection works only under app_loop (#563), so headlessly — and for mouse-only users under app_loop — a combobox can never change its selection via its dropdown.

Reproduce (headless, gfx stubbed like tests/test_ui.eigs): build combobox of ["cb", 10, 10, 120, ["a", "b"], null] in a panel, dispatch a mousedown on the combobox (opens it, open == 1), then dispatch a mousedown at the first dropdown item's position — selected stays -1 and open is 0.

Fix sketch: in dispatch's mousedown branch, hit-test BEFORE closing dropdowns, and if the hit is inside an open dropdown's extended bounds, deliver the click to it; only close dropdowns the click is outside of.

Downstream workaround (DeslanStudio wave/synth views): a button whose label shows the current value + a popup menu via show_menu — the menu widget selects on its own hover/mousedown path, which works under plain dispatch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions