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

Input looses focus #56

Open
abubakir1997 opened this issue Jul 11, 2024 · 2 comments
Open

Input looses focus #56

abubakir1997 opened this issue Jul 11, 2024 · 2 comments

Comments

@abubakir1997
Copy link

For some reason using useClippy hook in a component causes the body to be set as the focus element when that component is initially rendered. This causes the input field to loose focus. Test in blueprintjs popover

@abubakir1997
Copy link
Author

It seems the issue is caused by creating an element in body to copy the text using the old copy method. The navigator clipboard API should be used first if available. And the element should be created inside the focus item instead of body could potentially resolve the issue.

@CharlesStover
Copy link
Owner

This is a great find. I'm not positive that I'll have bandwidth to address it though, but a PR would be welcome.

I'd have one concern with putting the new input inside the currently focused element, being that that may not work if the currently focused element is a text input. The best bet may be to remember the previously-focused element, then focus it again after the copy action is complete.

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