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

Defocus every first typing #30

Open
Planxnx opened this issue Dec 10, 2023 · 1 comment
Open

Defocus every first typing #30

Planxnx opened this issue Dec 10, 2023 · 1 comment

Comments

@Planxnx
Copy link

Planxnx commented Dec 10, 2023

When you try to type the text for the first time, it will re-render and defocus from the input box.
So you need to select the input box and type again (it's annoying)

My workaround is force re-rendering for the first load. Is there another solution to fix this problem ??

Here is an example: code sandbox.

Environments

- astro: 4.0.3
- @astrojs/react: 3.0.7
- react: 18.2.0
- use-editable: 2.3.3
- prism-react-renderer: 2.3.0
@keenbug
Copy link

keenbug commented Jan 17, 2024

TLDR: Try adding tabIndex={-1} to the container.

I also ran into this problem. It seems to be related to Chrome/Chromium, I haven't seen the problem in Firefox or Safari. use-editable already seems to have a workaround for this, see the code.

Adding tabIndex={-1} may be needed for the workaround to function, see BugEditor.tsx:21 in the updated code sandbox.

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

No branches or pull requests

2 participants