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

Autofocus input #63

Merged
merged 3 commits into from
Oct 29, 2024
Merged

Autofocus input #63

merged 3 commits into from
Oct 29, 2024

Conversation

kevin-on
Copy link
Collaborator

@kevin-on kevin-on commented Oct 29, 2024

Implemented custom AutoFocusPlugin.

Problem in Lexical's AutoFocusPlugin

if (rootElement !== null && (activeElement === null || !rootElement.contains(activeElement))) {
  // Note: preventScroll won't work in Webkit.
  rootElement.focus({
    preventScroll: true
  });
}
  • In our use case, activeElement (MarkdownView) doesn't contain rootElement (ChatUserInput)

glowingjade
glowingjade previously approved these changes Oct 29, 2024
@kevin-on kevin-on linked an issue Oct 29, 2024 that may be closed by this pull request
@kevin-on kevin-on merged commit d6c7793 into main Oct 29, 2024
1 check passed
@kevin-on kevin-on deleted the kevin/autofocus-input branch October 29, 2024 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatically focus input on chat view open
2 participants