From 81555eafba10756dc2638c06ff95f355a0690e2e Mon Sep 17 00:00:00 2001 From: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Date: Fri, 24 Jan 2020 04:07:28 -0500 Subject: [PATCH] [MM-21341] Changed keyboard shortcut logic to pull focused web contents if an explicitly focused tab is not found (#1151) --- src/browser/components/MainPage.jsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/browser/components/MainPage.jsx b/src/browser/components/MainPage.jsx index a7942ee4..b18935bd 100644 --- a/src/browser/components/MainPage.jsx +++ b/src/browser/components/MainPage.jsx @@ -81,10 +81,6 @@ export default class MainPage extends React.Component { getTabWebContents(index = this.state.key || 0, teams = this.props.teams) { const allWebContents = remote.webContents.getAllWebContents(); - const openDevTools = allWebContents.find((webContents) => webContents.getURL().includes('chrome-devtools') && webContents.isFocused()); - if (openDevTools) { - return openDevTools; - } if (this.state.showNewTeamModal) { const indexURL = '/browser/index.html'; @@ -98,7 +94,8 @@ export default class MainPage extends React.Component { if (!tabURL) { return null; } - return allWebContents.find((webContents) => webContents.getURL().includes(tabURL) || webContents.getURL().includes(this.refs[`mattermostView${index}`].getSrc())); + const tab = allWebContents.find((webContents) => webContents.isFocused() && webContents.getURL().includes(this.refs[`mattermostView${index}`].getSrc())); + return tab || remote.webContents.getFocusedWebContents(); } componentDidMount() {