mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
PLT-3897 Fixed ALT+UP/DOWN crashing browser (#3848)
* Fixed ALT+UP/DOWN crashing browser * changed order of return
This commit is contained in:
@@ -65,6 +65,7 @@ export default class Sidebar extends React.Component {
|
||||
this.updateScrollbarOnChannelChange = this.updateScrollbarOnChannelChange.bind(this);
|
||||
|
||||
this.isLeaving = new Map();
|
||||
this.isSwitchingChannel = false;
|
||||
|
||||
const state = this.getStateFromStores();
|
||||
state.newChannelModalType = '';
|
||||
@@ -281,6 +282,12 @@ export default class Sidebar extends React.Component {
|
||||
navigateChannelShortcut(e) {
|
||||
if (e.altKey && !e.shiftKey && (e.keyCode === Constants.KeyCodes.UP || e.keyCode === Constants.KeyCodes.DOWN)) {
|
||||
e.preventDefault();
|
||||
|
||||
if (this.isSwitchingChannel) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isSwitchingChannel = true;
|
||||
const allChannels = this.getDisplayedChannels();
|
||||
const curChannelId = this.state.activeId;
|
||||
let curIndex = -1;
|
||||
@@ -299,12 +306,19 @@ export default class Sidebar extends React.Component {
|
||||
nextChannel = allChannels[Utils.mod(nextIndex, allChannels.length)];
|
||||
ChannelActions.goToChannel(nextChannel);
|
||||
this.updateScrollbarOnChannelChange(nextChannel);
|
||||
this.isSwitchingChannel = false;
|
||||
}
|
||||
}
|
||||
|
||||
navigateUnreadChannelShortcut(e) {
|
||||
if (e.altKey && e.shiftKey && (e.keyCode === Constants.KeyCodes.UP || e.keyCode === Constants.KeyCodes.DOWN)) {
|
||||
e.preventDefault();
|
||||
|
||||
if (this.isSwitchingChannel) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isSwitchingChannel = true;
|
||||
const allChannels = this.getDisplayedChannels();
|
||||
const curChannelId = this.state.activeId;
|
||||
let curIndex = -1;
|
||||
@@ -333,6 +347,7 @@ export default class Sidebar extends React.Component {
|
||||
nextChannel = allChannels[nextIndex];
|
||||
ChannelActions.goToChannel(nextChannel);
|
||||
this.updateScrollbarOnChannelChange(nextChannel);
|
||||
this.isSwitchingChannel = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user