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

Various keys escape the terminal #136

Closed
jmmv opened this issue Nov 10, 2021 · 1 comment · Fixed by #147
Closed

Various keys escape the terminal #136

jmmv opened this issue Nov 10, 2021 · 1 comment · Fixed by #147
Labels
bug Something isn't working

Comments

@jmmv
Copy link
Collaborator

jmmv commented Nov 10, 2021

Pressing the Tab key when inside the web interface causes the terminal to lose focus, as the input focus moves to the next element in the DOM. This is annoying when within the editor because Tab can be used for indentation.

I tried a simple fix to call terminal.focus() on key up/down events but that did not fix the problem, so filing this bug instead to track this issue.

@jmmv jmmv added the bug Something isn't working label Nov 10, 2021
Protowalker added a commit to Protowalker/endbasic that referenced this issue Dec 3, 2021
Protowalker added a commit to Protowalker/endbasic that referenced this issue Dec 4, 2021
Protowalker added a commit to Protowalker/endbasic that referenced this issue Dec 4, 2021
@jmmv
Copy link
Collaborator Author

jmmv commented Dec 8, 2021

Similarly, turning on Caret browsing, or simply pressing the / key on Firefox cause the browser to interpret key presses that it should not be seeing. The root cause of the problem seems to be the same as the one behind the Tab key mishandling.

@jmmv jmmv changed the title Tab key causes the terminal to lose focus on the web Various keys escape the terminal Dec 8, 2021
jmmv added a commit that referenced this issue Dec 8, 2021
There are a bunch of key presses that should be recognized by EndBASIC
but that are also recognized by the browser.  Some include the Tab key,
the arrow keys (when "caret browsing" is enabled), and the slash key
in Firefox.

Before, pressing any of these keys would cause the browser to also
perform their default action, which meant that the REPL would misbehave
by losing focus or triggering links.  With this change, we prevent the
events from propagating to the browser once we have handled them so
that this problem doesn't surface.

This change is inspired by the fix submitted by @Protowalker in #140.

Fixes #136.
jmmv added a commit that referenced this issue Dec 8, 2021
There are a bunch of key presses that should be recognized by EndBASIC
but that are also recognized by the browser.  Some include the Tab key,
the arrow keys (when "caret browsing" is enabled), and the slash key
in Firefox.

Before, pressing any of these keys would cause the browser to also
perform their default action, which meant that the REPL would misbehave
by losing focus or triggering links.  With this change, we prevent the
events from propagating to the browser once we have handled them so
that this problem doesn't surface.

This change is inspired by the fix submitted by @Protowalker in #140.

Fixes #136.
jmmv added a commit that referenced this issue Dec 8, 2021
There are a bunch of key presses that should be recognized by EndBASIC
but that are also recognized by the browser.  Some include the Tab key,
the arrow keys (when "caret browsing" is enabled), and the slash key
in Firefox.

Before, pressing any of these keys would cause the browser to also
perform their default action, which meant that the REPL would misbehave
by losing focus or triggering links.  With this change, we prevent the
events from propagating to the browser once we have handled them so
that this problem doesn't surface.

This change is inspired by the fix submitted by @Protowalker in #140.

Fixes #136.
jmmv added a commit that referenced this issue Dec 9, 2021
There are a bunch of key presses that should be recognized by EndBASIC
but that are also recognized by the browser.  Some include the Tab key,
the arrow keys (when "caret browsing" is enabled), and the slash key
in Firefox.

Before, pressing any of these keys would cause the browser to also
perform their default action, which meant that the REPL would misbehave
by losing focus or triggering links.  With this change, we prevent the
events from propagating to the browser once we have handled them so
that this problem doesn't surface.

Manually tested this on an iPad and on an Android emulator and there
don't seem to be regressions with the previous behavior.

This change is inspired by the fix submitted by @Protowalker in #140.

Fixes #136.
@jmmv jmmv closed this as completed in #147 Dec 9, 2021
jmmv added a commit that referenced this issue Dec 9, 2021
There are a bunch of key presses that should be recognized by EndBASIC
but that are also recognized by the browser.  Some include the Tab key,
the arrow keys (when "caret browsing" is enabled), and the slash key
in Firefox.

Before, pressing any of these keys would cause the browser to also
perform their default action, which meant that the REPL would misbehave
by losing focus or triggering links.  With this change, we prevent the
events from propagating to the browser once we have handled them so
that this problem doesn't surface.

Manually tested this on an iPad and on an Android emulator and there
don't seem to be regressions with the previous behavior.

This change is inspired by the fix submitted by @Protowalker in #140.

Fixes #136.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant