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

Playground: Minor issue, caret is not kept in view when pressing Enter, Tab. #18

Open
dmitshur opened this issue Jan 14, 2015 · 1 comment
Labels

Comments

@dmitshur
Copy link
Member

This is an extremely minor issue.

In (all) text editors, if you move the caret with arrow keys, or edit text (e.g., press enter) such that the caret goes off screen, the viewport is scrolled to keep the caret in view.

Due to the overriding of Enter and Tab behaviors combined with event.PreventDefault(), pressing enter or tab while caret is offscreen does not bring the caret into view.

@dmitshur dmitshur added the bug label Jan 14, 2015
@dmitshur
Copy link
Member Author

This seems to be a pretty common problem in browsers when trying to override some key behavior and/or move caret position programmatically.

Some solutions seem to be to emit a keyboard event, or arrange for event.PreventDefault() to not happen (this is how the Go Playground avoid this problem on Return, but it has the same issue when pressing Tab; it's just less noticeable since Tab doesn't move the caret offscreen vertically).

Relevant findings:

http://www.experts-exchange.com/Software/Internet_Email/Web_Browsers/Q_23940793.html
http://stackoverflow.com/questions/7892902/possible-to-scroll-caret-into-view-inside-a-single-html-text-field-with-javascri

@dmitshur dmitshur changed the title GopherJS Playground: Minor issue, caret is not kept in view when pressing Enter, Tab. Playground: Minor issue, caret is not kept in view when pressing Enter, Tab. Jun 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant