From dbd963fbf0cba551443a874c4fd2ec3b31cf9a26 Mon Sep 17 00:00:00 2001 From: Yuya Ochiai Date: Fri, 7 Apr 2017 21:33:58 +0900 Subject: [PATCH] Use sheet-end event to handle focus when closing macOS file upload dialog --- CHANGELOG.md | 4 ++++ src/browser/components/MainPage.jsx | 9 +++++++++ src/main/mainWindow.js | 4 ++++ 3 files changed, 17 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18543123..c19f394c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,10 @@ Release date: TBD - Fixed mis-aligned `+` button of tab bar. [#541](https://github.com/mattermost/desktop/issues/541) +#### Mac + - Fixed an issue where the text box didn't keep focus after uploading a file. + [#341](https://github.com/mattermost/desktop/issues/341) + --- ## Release v3.7.0 diff --git a/src/browser/components/MainPage.jsx b/src/browser/components/MainPage.jsx index 9fa6ae70..965066a5 100644 --- a/src/browser/components/MainPage.jsx +++ b/src/browser/components/MainPage.jsx @@ -104,6 +104,10 @@ const MainPage = createReactClass({ ipcRenderer.on('add-server', () => { this.addServer(); }); + + ipcRenderer.on('focus-on-webview', () => { + this.focusOnWebView(); + }); }, componentDidUpdate(prevProps, prevState) { if (prevState.key !== this.state.key) { // i.e. When tab has been changed @@ -207,6 +211,11 @@ const MainPage = createReactClass({ showNewTeamModal: true }); }, + + focusOnWebView() { + this.refs[`mattermostView${this.state.key}`].focusOnWebView(); + }, + render() { var self = this; diff --git a/src/main/mainWindow.js b/src/main/mainWindow.js index 83175758..df75600e 100644 --- a/src/main/mainWindow.js +++ b/src/main/mainWindow.js @@ -107,6 +107,10 @@ function createMainWindow(config, options) { } }); + mainWindow.on('sheet-end', () => { + mainWindow.webContents.send('focus-on-webview'); + }); + return mainWindow; }