Skip to content

fix(palette): cancel hover timeout on click to prevent double-click needed to open palette#7496

Open
KeerthiKumarR wants to merge 1 commit into
sugarlabs:masterfrom
KeerthiKumarR:fix/palette-double-click
Open

fix(palette): cancel hover timeout on click to prevent double-click needed to open palette#7496
KeerthiKumarR wants to merge 1 commit into
sugarlabs:masterfrom
KeerthiKumarR:fix/palette-double-click

Conversation

@KeerthiKumarR

@KeerthiKumarR KeerthiKumarR commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Fixes: #7495

Problem

When a palette (e.g. Meter) is open and the user clicks a different palette
(e.g. Ornament), the new palette does not open on the first click — a second
click is required.

Root Cause

_loadPaletteButtonHandler sets a 400ms hover timeout via _menuOpenTimeout
on onmouseover that calls showPalette. When the user moves the mouse from
one palette row to another and clicks, the hover timeout from the mouseover
fires and calls _hideMenus, racing with the click handler which also calls
showPalette. The net result is the first click only closes the open palette
without opening the new one.

The onmouseout handler already calls _clearPendingMenuOpen() to cancel
the timeout, but onclick did not — leaving the race condition open.

PR category

  • Bug Fix

Fix

Add this._clearPendingMenuOpen() at the top of the onclick else-branch in
_loadPaletteButtonHandler, consistent with how onmouseout already handles it.

Files Changed

  • js/palette.js — one line added in _loadPaletteButtonHandler

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Jest Test Results

✅ All Jest tests passed! This PR is ready to merge.

Coverage: Statements: 48.3% | Branches: 39.92% | Functions: 53.01% | Lines: 48.7%
Master Coverage: Statements: 48.29% | Branches: 39.91% | Functions: 52.99% | Lines: 48.69%

@github-actions github-actions Bot added bug fix Fixes a bug or incorrect behavior size/XS Extra small: < 10 lines changed area/javascript Changes to JS source files labels Jun 10, 2026
@KeerthiKumarR

Copy link
Copy Markdown
Contributor Author

@walterbender @Ashutoshx7 Please have a look when you have time!

@sapnilbiswas sapnilbiswas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

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

Labels

area/javascript Changes to JS source files bug fix Fixes a bug or incorrect behavior size/XS Extra small: < 10 lines changed

Projects

Development

Successfully merging this pull request may close these issues.

[Bug] Clicking a palette requires double-click when another palette is already open

2 participants