From f8d5dcd060c069ec39a97906d42a9593c3055f8f Mon Sep 17 00:00:00 2001 From: Matheus Fernandes Date: Sat, 14 Jan 2017 18:12:08 -0200 Subject: [PATCH] :bug: Fix a regression from the previous commit and a comment --- lib/hterm.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/hterm.js b/lib/hterm.js index ab510d79..f0e8852f 100644 --- a/lib/hterm.js +++ b/lib/hterm.js @@ -394,10 +394,14 @@ hterm.Screen.prototype.syncSelectionCaret = function () { s.addRange(r); }; -const oldScrollPortFocus = hterm.ScrollPort.prototype.focus; +// For some reason, when the original version of this function was called right +// after a new tab was created, it was breaking the focus of the other tab. +// After some investigation, I (matheuss) found that `this.iframe_.focus();` (from +// the original function) was causing the issue. So right now we're overriding +// the function to prevent the `iframe_` from being focused. +// This shouldn't create any side effects – we're _stealing_ the focus from `htem` anyways. hterm.ScrollPort.prototype.focus = function () { - oldScrollPortFocus(); - this.terminal.focusHyperCaret(); + this.screen_.focus(); }; // fixes a bug in hterm, where the cursor goes back to `BLOCK`