webmacs icon indicating copy to clipboard operation
webmacs copied to clipboard

Focus moves to the first input element on a page when buffer loses focus

Open TLATER opened this issue 6 years ago • 5 comments

Edit: We have a workaround!

from webmacs import keymaps
from webmacs.commands import define_command

global_map = keymaps.keymap("global")
define_command("noop", binding=lambda: None, visible=False)
global_map.define_key("Tab", "noop")

When I switch either using C-x b or to a different workspace with my window manager, webmacs will sometimes suddenly place focus on the first input element on the page displayed in the buffer that was just moved out of focus. This does not happen every time, but is pretty consistent if the switch occurs for more than a few seconds.

This is incredibly annoying since it loses my place in the page I was viewing and it takes a number of keystrokes to get rid of the focus (occasionally, C-g won't even work, forcing me to click somewhere on the page).

As a workaround I've started opening the search input with C-s before I switch windows, which inhibits any changes to the page, but well, this isn't nice.

I'm not sure if I'm accidentally triggering intended behavior and just unaware of a keybinding, but some help in figuring out what's going on would be appreciated.

TLATER avatar Feb 16 '19 01:02 TLATER

Ok, thanks for the detailed report.

Can you give me the content of the version buffer please, using <M-x version>? It might be related to the Qt version.

parkouss avatar Feb 19 '19 18:02 parkouss

Yup, sorry, should have done that in the first place:

Webmacs version: | 0.8 (034a46aee33a0c33c0b66866faaaa1ea926b6a82)
-- | --
Operating system: | linux
Python version: | 3.7.2 (default, Jan 10 2019, 23:51:51) [GCC 8.2.1 20181127]
Qt version: | 5.12.1
PyQt version: | 5.12
Chromium version: | 69.0.3497.128
Opengl vendor: | NVIDIA Corporation

TLATER avatar Feb 20 '19 22:02 TLATER

I'm seeing this too. Weirdly enough, it doesn't just jump to the first input element, it cycles input elements on subsequent focus events.

Webmacs version: | 0.8 (034a46aee33a0c33c0b66866faaaa1ea926b6a82)
-- | --
Operating system: | linux
Python version: | 3.7.2 (default, Jan 10 2019, 23:51:51) [GCC 8.2.1 20181127]
Qt version: | 5.12.1
PyQt version: | 5.12
Chromium version: | 69.0.3497.128
Opengl vendor: | Intel Open Source Technology Center

It happens consistently for me with C-x b. E.g. I'm seeing it on this page.

jollm avatar Mar 11 '19 11:03 jollm

This is caused by a QtWebengine bug, as reported in the qutebrowser github issue. The issue is actually that switching to QtWebengine browsers (with at least some WMs?) sends an erroneous <TAB> keypress (which, by default, cycles to the next input element).

Thus, rebinding <TAB> to a command that doesn't scroll the buffer is a temporary (if inelegant) workaround. I'm not sure if the QtWebEngine project is aware of this bug or not.

codesections avatar Mar 16 '19 18:03 codesections

Thanks! Can confirm that binding Tab to a noop command in global prevents the undesirable behavior.

jollm avatar Mar 17 '19 08:03 jollm