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

Clicking outside editor breaks combobox #3853

Open
olee opened this issue Dec 12, 2024 · 1 comment
Open

Clicking outside editor breaks combobox #3853

olee opened this issue Dec 12, 2024 · 1 comment
Labels
bug Something isn't working plugin:combobox

Comments

@olee
Copy link

olee commented Dec 12, 2024

Description

When you open a combobox (eg. typing / for slash commands or @ for mentions etc.) and then click somewhere other than another text line in the editor, the combobox will neither close, nor will it be possible to focus it for typing again. This can be tested out on the official plate demo as well:

PowerToys_Z9h2XbyJ2N.mp4

Reproduction URL

https://platejs.org/

Reproduction steps

1. Go to https://platejs.org/
2. Click in the editor and type `@` or `/`
3. Click outside the editor
4. The combobox will not close and clicking at the end of the text line will not allow to continue typing as well

Expected outcome

Clicking outside the editor should close the combobox properly

Plate version

latest

Slate React version

latest

@olee olee added the bug Something isn't working label Dec 12, 2024
@12joan
Copy link
Collaborator

12joan commented Dec 12, 2024

The combobox can be configured to close on blur by changing the cancelInputOnBlur option passed to useComboboxInput in inline-combobox.tsx from false to true.

@olee Can you try making the change to cancelInputOnBlur, and if it doesn't cause any other issues, open a PR on Plate?

The issue where you can't refocus the input after clicking away is a bug in Chrome, and only occurs when trying to focus an input at the end of a line by clicking to the right of it. (Firefox and Safari handle this case correctly by selecting the paragraph just after the combobox, causing it to close.) It's still possible to focus the input in Chrome if you click on the text itself.

recording.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working plugin:combobox
Projects
None yet
Development

No branches or pull requests

2 participants