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.

can't programmatically focus the editor anymore...

See original GitHub issue

Do you want to request a feature or report a bug?

feature

What’s the current behavior?

There’s no longer a way to give programmatically focus to the content-editable element. In slate 0.4x it was possibile to attach a ref to the <Editor> component. This is no longer the case because <Editable> is a stateless component

Slate: 0.57.0 Browser: all OS: all

What’s the expected behavior?

It should be possible to give focus programmatically to the editor

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
MarkParecommented, Jan 8, 2020

Is this documented anywhere?

8reactions
paullaffittecommented, Mar 19, 2020

@MarkPare I found that you can import ReactEditor from slate-react and it has a focus method. Here is how you can use it.

import { ReactEditor } from 'slate-react';
ReactEditor.focus(editor);

With editor being an instance of your editor. You can get it from createEditor() or useSlate() depending on where do you need it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

how react programmatically focus input - Stack Overflow
I'm trying to implement a very simple use case, a UI feature, where: There is a label with some content in it; If...
Read more >
ASPxGridView - Cannot set focus to ASPxMemo in Edit Form ...
Hi, I have a gird.Edit form as popup, one aspxmemo input field is there in edit popup. While click on AddNewRow or edit...
Read more >
Setting keyboard focus to edit control. - MSDN - Microsoft
I tried using SendDlgItemMessage(hwnd,IDC_USERID,WM_SETFOCUS,0,0); The problem with this is that i cant write in that edit control anymore.
Read more >
Can't focus on ios - Discuss - ProseMirror
My problem: Neither focus() on my editor view instance nor editorViewInstance.dom.focus() will trigger the keyboard to show on ios.
Read more >
React Focus on an Input Field - OutSystems
One minor requirement is to set the focus to the Input box on the next form. The JS fuction on that Focus client...
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