diff --git a/CHANGELOG.md b/CHANGELOG.md index 92eb53a2..77326cbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ - bug fixes - range: value not properly updated with set() +- misc + - (built-in client only) add `nofocus` client option to prevent the client window from taking focus unless a text input or a dropdown is clicked. + ## 1.9.10 diff --git a/resources/docs/docs/client-options.md b/resources/docs/docs/client-options.md index 83f47f70..815d795e 100644 --- a/resources/docs/docs/client-options.md +++ b/resources/docs/docs/client-options.md @@ -13,6 +13,7 @@ Client options can be set either with the server's `--client-options` option, or | consoleLength | number | 300 | sets the maximum number of log messages in the client's console | | id | string | *random_id* | client's unique id (use with caution: two clients should never have the same id) | | usePercents | 1 / 0 | 0 | sets the editor's "relative units" option | +| nofocus | 1 / 0 | 0 | (built-in client only) prevent the client window from taking focus unless a text input or a dropdown is clicked | Example: diff --git a/src/client/events/click.js b/src/client/events/click.js index 206072c0..e6b1e5df 100644 --- a/src/client/events/click.js +++ b/src/client/events/click.js @@ -33,6 +33,10 @@ function mouseToFastClick(event) { DOM.dispatchEvent(e.target, name, e) + if (ENV.nofocus && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') { + console.debug('ELECTRON.BLUR()') + } + } function touchToFastClick(event) { @@ -59,6 +63,10 @@ function touchToFastClick(event) { }, 600) + if (ENV.nofocus && e.target.tagName !== 'INPUT' && e.target.tagName !== 'TEXTAREA' && e.target.tagName !== 'SELECT') { + console.debug('ELECTRON.BLUR()') + } + } if (!iOS) document.addEventListener('pointerdown', mouseToFastClick, true)