Skip to content

ui: fix SELECT dropdown to use click-to-open model#3253

Open
amoghmohanty12 wants to merge 1 commit into
google-deepmind:mainfrom
amoghmohanty12:fix/select-dropdown-click-to-open
Open

ui: fix SELECT dropdown to use click-to-open model#3253
amoghmohanty12 wants to merge 1 commit into
google-deepmind:mainfrom
amoghmohanty12:fix/select-dropdown-click-to-open

Conversation

@amoghmohanty12
Copy link
Copy Markdown

Problem

The mjITEM_SELECT widget uses a press-and-hold drag-to-select model: the dropdown is visible only while the mouse button is held, and the release event selects whichever option is under the cursor at that moment.

On platforms where GLFW fires PRESS and RELEASE in rapid succession — most notably WSL/WSLg on Windows — the dropdown opens and closes in the same frame, making it impossible to select any option. The widget appears to do nothing when clicked.

Fix

Changes mjITEM_SELECT to a click-to-open / click-to-select model while preserving full backward compatibility with the drag-to-select workflow:

In the PRESS handler (before the global mousesect = 0 reset):

  • If a SELECT dropdown is already open and the cursor is over one of its options → select that option and close (enables click-on-option selection)
  • If the cursor is back on the same header → toggle closed

In the RELEASE handler:

  • If an option is under the cursor → select and close (unchanged)
  • If no option is under the cursor (quick click on header) → keep the dropdown open rather than closing it

The original drag behaviour is fully preserved: pressing, dragging the cursor onto an option, and releasing still selects that option immediately via the RELEASE path.

Testing

Verified on WSL2 (Ubuntu 24.04 / WSLg) running MuJoCo via mujoco_mpc. All SELECT dropdowns (task, planner, integrator, solver, etc.) now respond correctly to single clicks.

The mjITEM_SELECT widget used a press-and-hold drag-to-select model:
the dropdown was visible only while the mouse button was held, and the
release event selected whichever option was under the cursor.

On platforms where GLFW fires PRESS and RELEASE in rapid succession
(notably WSL/WSLg), this caused the dropdown to open and close in the
same frame with no opportunity to select an option.

This commit changes SELECT to a click-to-open / click-to-select model:

- PRESS while dropdown is open: if cursor is over an option, select it
  and close; if cursor is on the header again, toggle closed.
- RELEASE with no option under cursor: keep the dropdown open rather
  than closing it, so a quick click opens and leaves it open.

The original drag-to-select behaviour is preserved: pressing, dragging
onto an option, and releasing still selects that option immediately.
@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 1, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@yuvaltassa yuvaltassa self-assigned this May 18, 2026
@yuvaltassa
Copy link
Copy Markdown
Collaborator

Can you do the CLA thing please?

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