From dc1f276759e55ba3d36fe2eb675e71c25159e277 Mon Sep 17 00:00:00 2001 From: dakshkanaujia <58256644+dakshkanaujia@users.noreply.github.com> Date: Tue, 30 Jul 2024 20:54:15 +0530 Subject: [PATCH] fix!: Redundant blockly non selectable #8328 (#8433) * Remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes * Removed .gitpod file * fix: remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes https://github.com/google/blockly/issues/8328 * fix: remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes #8328 * fix: remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes #8328 * fix: remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes #8328 * fix: remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes #8328 * fix: remove redundant blocklyNonSelectable class and integrate non-selectability into existing classes --- core/css.ts | 12 ++++++------ core/menu.ts | 3 ++- core/toolbox/toolbox.ts | 4 +++- tests/mocha/toolbox_test.js | 5 +---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/css.ts b/core/css.ts index 7a0053604..00d4f1be4 100644 --- a/core/css.ts +++ b/core/css.ts @@ -80,12 +80,6 @@ let content = ` touch-action: none; } -.blocklyNonSelectable { - user-select: none; - -ms-user-select: none; - -webkit-user-select: none; -} - .blocklyBlockCanvas.blocklyCanvasTransitioning, .blocklyBubbleCanvas.blocklyCanvasTransitioning { transition: transform .5s; @@ -430,6 +424,9 @@ input[type=number] { } .blocklyWidgetDiv .blocklyMenu { + user-select: none; + -ms-user-select: none; + -webkit-user-select: none; background: #fff; border: 1px solid transparent; box-shadow: 0 0 3px 1px rgba(0,0,0,.3); @@ -449,6 +446,9 @@ input[type=number] { } .blocklyDropDownDiv .blocklyMenu { + user-select: none; + -ms-user-select: none; + -webkit-user-select: none; background: inherit; /* Compatibility with gapi, reset from goog-menu */ border: inherit; /* Compatibility with gapi, reset from goog-menu */ font: normal 13px "Helvetica Neue", Helvetica, sans-serif; diff --git a/core/menu.ts b/core/menu.ts index 31eda5c3d..6085d9274 100644 --- a/core/menu.ts +++ b/core/menu.ts @@ -82,9 +82,10 @@ export class Menu { * @param container Element upon which to append this menu. * @returns The menu's root DOM element. */ + render(container: Element): HTMLDivElement { const element = document.createElement('div'); - element.className = 'blocklyMenu blocklyNonSelectable'; + element.className = 'blocklyMenu'; element.tabIndex = 0; if (this.roleName) { aria.setRole(element, this.roleName); diff --git a/core/toolbox/toolbox.ts b/core/toolbox/toolbox.ts index 1e2a5970f..cd91b2d8a 100644 --- a/core/toolbox/toolbox.ts +++ b/core/toolbox/toolbox.ts @@ -199,7 +199,6 @@ export class Toolbox const toolboxContainer = document.createElement('div'); toolboxContainer.setAttribute('layout', this.isHorizontal() ? 'h' : 'v'); dom.addClass(toolboxContainer, 'blocklyToolboxDiv'); - dom.addClass(toolboxContainer, 'blocklyNonSelectable'); toolboxContainer.setAttribute('dir', this.RTL ? 'RTL' : 'LTR'); return toolboxContainer; } @@ -1104,6 +1103,9 @@ Css.register(` /* Category tree in Toolbox. */ .blocklyToolboxDiv { + user-select: none; + -ms-user-select: none; + -webkit-user-select: none; background-color: #ddd; overflow-x: visible; overflow-y: auto; diff --git a/tests/mocha/toolbox_test.js b/tests/mocha/toolbox_test.js index b3cd45090..755f08cf8 100644 --- a/tests/mocha/toolbox_test.js +++ b/tests/mocha/toolbox_test.js @@ -47,10 +47,7 @@ suite('Toolbox', function () { test('Init called -> HtmlDiv is inserted before parent node', function () { const toolboxDiv = Blockly.common.getMainWorkspace().getInjectionDiv() .childNodes[0]; - assert.equal( - toolboxDiv.className, - 'blocklyToolboxDiv blocklyNonSelectable', - ); + assert.equal(toolboxDiv.className, 'blocklyToolboxDiv'); }); test('Init called -> Toolbox is subscribed to background and foreground colour', function () { const themeManager = this.toolbox.workspace_.getThemeManager();