Skip to content

Commit 369c46e

Browse files
authored
#4154 issue: Fixed palette dropdown to prevent accidental switching (#4159)
1 parent 8a36b92 commit 369c46e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

js/palette.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -446,15 +446,20 @@ class Palettes {
446446
// Palette Button event handlers
447447
_loadPaletteButtonHandler(name, row) {
448448
// eslint-disable-next-line no-unused-vars
449-
row.onmouseover = (event) => {
450-
if (name == "search") {
449+
let timeout;
450+
451+
row.onmouseover = () => {
452+
if (name === "search") {
451453
document.body.style.cursor = "text";
452454
} else {
453455
document.body.style.cursor = "pointer";
454-
this.showPalette(name);
456+
clearTimeout(timeout);
457+
timeout = setTimeout(() => this.showPalette(name), 400);
455458
}
456459
};
457-
460+
461+
row.onmouseout = () => clearTimeout(timeout);
462+
458463
// eslint-disable-next-line no-unused-vars
459464
row.onclick = (event) => {
460465
if (name == "search") {

0 commit comments

Comments
 (0)