ui: fix SELECT dropdown to use click-to-open model#3253
Open
amoghmohanty12 wants to merge 1 commit into
Open
Conversation
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.
|
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. |
Collaborator
|
Can you do the CLA thing please? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
mjITEM_SELECTwidget 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
PRESSandRELEASEin 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_SELECTto a click-to-open / click-to-select model while preserving full backward compatibility with the drag-to-select workflow:In the
PRESShandler (before the globalmousesect = 0reset):In the
RELEASEhandler:The original drag behaviour is fully preserved: pressing, dragging the cursor onto an option, and releasing still selects that option immediately via the
RELEASEpath.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.