Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
TLATER opened this issue Feb 16, 2019 · 5 comments
Open

Comments

@TLATER
Copy link

TLATER commented Feb 16, 2019

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.

@parkouss
Copy link
Owner

Ok, thanks for the detailed report.

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

@TLATER
Copy link
Author

TLATER commented Feb 20, 2019

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

@jollm
Copy link

jollm commented Mar 11, 2019

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.

@codesections
Copy link

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.

@jollm
Copy link

jollm commented Mar 17, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants