question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Focus back to the editor from anywhere

See original GitHub issue

I’m having a modal that, on a given callback, gives me an URL.

I tried to embed the URL as insertImage using window.pell.exec('insertImage', completeURL); in my code, but after the modal appeared, I lost the focus on the editor.

How can I get the focus back ?

Note: I saw someone else having a similar problem (#83), and his closing answer was that he was losing focus. Since he closed it, I assume he managed to get back the right focus on the editor.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
hellonearthiscommented, Jul 31, 2018

I used this function. function focusEditor() { document.getElementsByClassName("pell-content")[0].focus(); }

1reaction
mkrakowskicommented, Aug 14, 2018

+1 on preserving cursor position. I’m adding an auto-complete menu that’s triggered by certain chars (e.g @, or #). It inserts into the correct place but then resets the cursor to the start of the editor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to gain "keyboard focus" back to Ace editor?
I need to click somewhere with mouse to get the normal cursor back: vim_after_clicking.png. Without key-bindings. Right after dismissing the ...
Read more >
Visual Studio: set focus to text editor - keyboard shortcuts
A solution for returning to the text-editor while Visual Studio has the focus is by using the hotkey Ctrl + Tab . Share....
Read more >
Keyboard shortcut to jump back to editor pane from ...
I found the shortcut to jump to the editor from the project pane (cmd+down arrow), but this only works for opening a new...
Read more >
Focus tracking - CKEditor 5 Documentation
Checking if the view document is focused​​ Click the editable area of the editor and then click somewhere else — the isFocused property...
Read more >
Focusing: focus/blur
That's when a user clicks somewhere else or presses Tab to go to the next form ... classList.add("error"); // ...and put the focus...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found