diff --git a/README.md b/README.md index 095a282..a83ca14 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,9 @@ options = { // Keep the fields of multiple selected same-type blocks with the same value multiFieldUpdate: true, + // Auto focus the workspace when the mouse enters. + workspaceAutoFocus: true, + // Use custom icon for the multi select controls. multiselectIcon: { hideIcon: false, diff --git a/src/multiselect.js b/src/multiselect.js index f73818f..8235029 100644 --- a/src/multiselect.js +++ b/src/multiselect.js @@ -52,7 +52,8 @@ export class Multiselect { this.onFocusOutWrapper_ = Blockly.browserEvents.conditionalBind( injectionDiv, 'focusout', this, this.onBlur_); injectionDiv.addEventListener('mouseenter', () => { - if (document.activeElement === this.workspace_.svgGroup_.parentElement || + if (options.workspaceAutoFocus === false || + document.activeElement === this.workspace_.svgGroup_.parentElement || document.activeElement.nodeName.toLowerCase() === 'input' || document.activeElement.nodeName.toLowerCase() === 'textarea') { return;