-
I have two Focus is always reset to second (last) Is this correct behavior? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Yes. This is intended here, as when you clear the editor, it moves selection to the start of the empty editor – so in a way, it's triggering an auto selection by doing this. As you're doing clearing both editors, the 2nd will also get the last selection trigger. What would your desired effect here be? I'd recommend maybe creating your own |
Beta Was this translation helpful? Give feedback.
-
@trueadm could you shed some light on the reasoning 🤔 why it's desirable? From my perspective, we should be able to clear the editor's content without focusing or at least prevent that via another prop/argument. I have the same issue and don't know how to prevent/overwrite the behavior - at this point, the page scrolls to the last editor that is displayed at the bottom of the page. |
Beta Was this translation helpful? Give feedback.
Yes. This is intended here, as when you clear the editor, it moves selection to the start of the empty editor – so in a way, it's triggering an auto selection by doing this. As you're doing clearing both editors, the 2nd will also get the last selection trigger. What would your desired effect here be?
I'd recommend maybe creating your own
onClear
function and passing it to<LexicalClearEditorPlugin>
. That way you can opt to clear the editor, but not move focus to the end.