summaryrefslogtreecommitdiffstats
path: root/web/react/components/channel_loader.jsx
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-09-24 10:13:14 -0400
committerJoramWilander <jwawilander@gmail.com>2015-09-24 10:13:14 -0400
commit21a1eaa18971e5e72a4b3d19d2c1e78da71d4084 (patch)
tree957ccf0e40fbac100e3b712bcf532f33f2df0783 /web/react/components/channel_loader.jsx
parent4f371254c68fe41365f3c03001743a035bc63384 (diff)
downloadchat-21a1eaa18971e5e72a4b3d19d2c1e78da71d4084.tar.gz
chat-21a1eaa18971e5e72a4b3d19d2c1e78da71d4084.tar.bz2
chat-21a1eaa18971e5e72a4b3d19d2c1e78da71d4084.zip
Fixes backspace navigating back a page.
Diffstat (limited to 'web/react/components/channel_loader.jsx')
-rw-r--r--web/react/components/channel_loader.jsx9
1 files changed, 9 insertions, 0 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()) {