mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
fix: Fix bug that caused text to be selected when long-pressing in the workspace on a touch device. (#8670)
* fix: Fix bug that caused text to be selected when long-pressing in the workspace on a touch device. * chore: Fix test failure.
This commit is contained in:
13
core/css.ts
13
core/css.ts
@@ -79,6 +79,8 @@ let content = `
|
|||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden; /* So blocks in drag surface disappear at edges */
|
overflow: hidden; /* So blocks in drag surface disappear at edges */
|
||||||
touch-action: none;
|
touch-action: none;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.blocklyNonSelectable {
|
.blocklyNonSelectable {
|
||||||
@@ -266,17 +268,6 @@ let content = `
|
|||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Don't allow users to select text. It gets annoying when trying to
|
|
||||||
drag a block and selected text moves instead.
|
|
||||||
*/
|
|
||||||
.blocklySvg text {
|
|
||||||
user-select: none;
|
|
||||||
-ms-user-select: none;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
cursor: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blocklyHidden {
|
.blocklyHidden {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,7 +197,6 @@ export class Toolbox
|
|||||||
const toolboxContainer = document.createElement('div');
|
const toolboxContainer = document.createElement('div');
|
||||||
toolboxContainer.setAttribute('layout', this.isHorizontal() ? 'h' : 'v');
|
toolboxContainer.setAttribute('layout', this.isHorizontal() ? 'h' : 'v');
|
||||||
dom.addClass(toolboxContainer, 'blocklyToolboxDiv');
|
dom.addClass(toolboxContainer, 'blocklyToolboxDiv');
|
||||||
dom.addClass(toolboxContainer, 'blocklyNonSelectable');
|
|
||||||
toolboxContainer.setAttribute('dir', this.RTL ? 'RTL' : 'LTR');
|
toolboxContainer.setAttribute('dir', this.RTL ? 'RTL' : 'LTR');
|
||||||
return toolboxContainer;
|
return toolboxContainer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,10 +47,7 @@ suite('Toolbox', function () {
|
|||||||
test('Init called -> HtmlDiv is inserted before parent node', function () {
|
test('Init called -> HtmlDiv is inserted before parent node', function () {
|
||||||
const toolboxDiv = Blockly.common.getMainWorkspace().getInjectionDiv()
|
const toolboxDiv = Blockly.common.getMainWorkspace().getInjectionDiv()
|
||||||
.childNodes[0];
|
.childNodes[0];
|
||||||
assert.equal(
|
assert.equal(toolboxDiv.className, 'blocklyToolboxDiv');
|
||||||
toolboxDiv.className,
|
|
||||||
'blocklyToolboxDiv blocklyNonSelectable',
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
test('Init called -> Toolbox is subscribed to background and foreground colour', function () {
|
test('Init called -> Toolbox is subscribed to background and foreground colour', function () {
|
||||||
const themeManager = this.toolbox.workspace_.getThemeManager();
|
const themeManager = this.toolbox.workspace_.getThemeManager();
|
||||||
|
|||||||
Reference in New Issue
Block a user