diff options
author | Corey Hulen <corey@hulen.com> | 2015-09-24 08:58:32 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-09-24 08:58:32 -0700 |
commit | a7d75d3bceef5fa405e72968806c905bcc9d8b31 (patch) | |
tree | f6c67176abd66642bd1989e9e04382a733795720 /web | |
parent | d5343f997d8d239f09a93a05d8affd8387bb46bc (diff) | |
parent | 21a1eaa18971e5e72a4b3d19d2c1e78da71d4084 (diff) | |
download | chat-a7d75d3bceef5fa405e72968806c905bcc9d8b31.tar.gz chat-a7d75d3bceef5fa405e72968806c905bcc9d8b31.tar.bz2 chat-a7d75d3bceef5fa405e72968806c905bcc9d8b31.zip |
Merge pull request #778 from mattermost/plt-43
PLT-43 Fixes backspace navigating back a page.
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/channel_loader.jsx | 9 | ||||
-rw-r--r-- | web/react/components/settings_sidebar.jsx | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/web/react/components/channel_loader.jsx b/web/react/components/channel_loader.jsx index 962ba26ee..39c86405c 100644 --- a/web/react/components/channel_loader.jsx +++ b/web/react/components/channel_loader.jsx @@ -109,6 +109,13 @@ export default class ChannelLoader extends React.Component { $('.modal-body').css('overflow-y', 'auto'); $('.modal-body').css('max-height', $(window).height() * 0.7); }); + + /* Prevent backspace from navigating back a page */ + $(window).on('keydown.preventBackspace', (e) => { + if (e.which === 8 && !$(e.target).is('input, textarea')) { + e.preventDefault(); + } + }); } componentWillUnmount() { clearInterval(this.intervalId); @@ -123,6 +130,8 @@ export default class ChannelLoader extends React.Component { $('body').off('mouseenter mouseleave', '.post.post--comment.same--root'); $('.modal').off('show.bs.modal'); + + $(window).off('keydown.preventBackspace'); } onSocketChange(msg) { if (msg && msg.user_id && msg.user_id !== UserStore.getCurrentId()) { diff --git a/web/react/components/settings_sidebar.jsx b/web/react/components/settings_sidebar.jsx index e5cbd6e92..4c4675788 100644 --- a/web/react/components/settings_sidebar.jsx +++ b/web/react/components/settings_sidebar.jsx @@ -7,7 +7,8 @@ export default class SettingsSidebar extends React.Component { this.handleClick = this.handleClick.bind(this); } - handleClick(tab) { + handleClick(tab, e) { + e.preventDefault(); this.props.updateTab(tab.name); $('.settings-modal').addClass('display--content'); } |