diff options
author | 2020-04-21 01:48:18 +0530 | |
---|---|---|
committer | 2020-04-20 20:18:18 +0000 | |
commit | 4706721bfc1ad341c1775400f27d6a943265d188 (patch) | |
tree | 97facab3fcb5a354584fefd5357767b192c5ad30 /src | |
parent | docs: add mahadevans87 as a contributor (#612) (diff) | |
download | ferdium-app-4706721bfc1ad341c1775400f27d6a943265d188.tar.gz ferdium-app-4706721bfc1ad341c1775400f27d6a943265d188.tar.zst ferdium-app-4706721bfc1ad341c1775400f27d6a943265d188.zip |
Refocus Webview only for active service (#610)
* Fix: Refocus Webview only for active service
- add check to identify if the webview belongs to the active service during refocussing a webview.
- blur and focus the webview only for the active service.
Co-Authored-By: Sampath Kumar Krishnan <sampathblam@users.noreply.github.com>
* fix: Focus on Active Service
- replace document.activeElement.blur() with service.webview.blur()
Co-Authored-By: Sampath Kumar Krishnan <sampathblam@users.noreply.github.com>
* refactor
- lint fixes
Co-Authored-By: Sampath Kumar Krishnan <sampathblam@users.noreply.github.com>
Co-authored-by: Sampath Kumar Krishnan <sampathblam@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/components/services/content/ServiceWebview.js | 9 | ||||
-rw-r--r-- | src/stores/ServicesStore.js | 4 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/components/services/content/ServiceWebview.js b/src/components/services/content/ServiceWebview.js index 652647470..210a6ab6b 100644 --- a/src/components/services/content/ServiceWebview.js +++ b/src/components/services/content/ServiceWebview.js | |||
@@ -41,9 +41,14 @@ class ServiceWebview extends Component { | |||
41 | 41 | ||
42 | refocusWebview = () => { | 42 | refocusWebview = () => { |
43 | const { webview } = this; | 43 | const { webview } = this; |
44 | debug('Refocus Webview is called', this.props.service); | ||
44 | if (!webview) return; | 45 | if (!webview) return; |
45 | webview.view.blur(); | 46 | if (this.props.service.isActive) { |
46 | webview.view.focus(); | 47 | webview.view.blur(); |
48 | webview.view.focus(); | ||
49 | } else { | ||
50 | debug('Refocus not required - Not active service'); | ||
51 | } | ||
47 | }; | 52 | }; |
48 | 53 | ||
49 | render() { | 54 | render() { |
diff --git a/src/stores/ServicesStore.js b/src/stores/ServicesStore.js index b595c3543..0ad523374 100644 --- a/src/stores/ServicesStore.js +++ b/src/stores/ServicesStore.js | |||
@@ -495,9 +495,7 @@ export default class ServicesStore extends Store { | |||
495 | const service = this.one(serviceId); | 495 | const service = this.one(serviceId); |
496 | 496 | ||
497 | if (service.webview) { | 497 | if (service.webview) { |
498 | if (document.activeElement) { | 498 | service.webview.blur(); |
499 | document.activeElement.blur(); | ||
500 | } | ||
501 | service.webview.focus(); | 499 | service.webview.focus(); |
502 | } | 500 | } |
503 | } | 501 | } |