[MM-21341] Changed keyboard shortcut logic to pull focused web contents if an explicitly focused tab is not found (#1151)

This commit is contained in:
Devin Binnie 2020-01-24 04:07:28 -05:00 committed by Guillermo Vayá
parent 31cc745748
commit 81555eafba

View file

@ -81,10 +81,6 @@ export default class MainPage extends React.Component {
getTabWebContents(index = this.state.key || 0, teams = this.props.teams) { getTabWebContents(index = this.state.key || 0, teams = this.props.teams) {
const allWebContents = remote.webContents.getAllWebContents(); 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) { if (this.state.showNewTeamModal) {
const indexURL = '/browser/index.html'; const indexURL = '/browser/index.html';
@ -98,7 +94,8 @@ export default class MainPage extends React.Component {
if (!tabURL) { if (!tabURL) {
return null; 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() { componentDidMount() {