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

document actInsideInputWithModifier useKeyPress option #481

Open
Maquinours opened this issue Jun 27, 2023 · 4 comments
Open

document actInsideInputWithModifier useKeyPress option #481

Maquinours opened this issue Jun 27, 2023 · 4 comments
Labels
react-docs Issues belonging to the reactflow website

Comments

@Maquinours
Copy link

Maquinours commented Jun 27, 2023

Please describe the feature that you want to propose

Hi.

In my project, I use a UseKeyPress to trigger when CTRL + A is pressed to select all nodes & edges.
Also, my nodes contains inputs to enter some text.

The problem is, when I use CTRL + A on my input to select all the text inside, the UseKeyPress is triggered so it selects all my nodes.

Can we get a way to avoid useKeyPress to be triggered if a certain element is focused ? I tried the "nokey" className but it doesn't work in this case.

Thank you !

@moklick
Copy link
Member

moklick commented Jun 29, 2023

did you try to use the class name "nokey" ?

@Maquinours
Copy link
Author

Yep. I tried "nokey" and it didn't work. Actually, I used "nokey" for months and it was working.
Recently, I noticed that it was not working anymore.

@moklick moklick self-assigned this Jul 3, 2023
@moklick
Copy link
Member

moklick commented Apr 17, 2024

could you try:

const ctrlAPressed = useKeyPress('Control+a', { actInsideInputWithModifier: false });

?

@Pjaerr
Copy link

Pjaerr commented Apr 20, 2024

👋 Thanks @moklick I had the same issue and this suggestion fixed it for me. Is it worth getting this documented somewhere?

@moklick moklick removed their assignment Aug 22, 2024
@moklick moklick transferred this issue from xyflow/xyflow Aug 22, 2024
@moklick moklick changed the title useKeyPress trigger while input is focused document actInsideInputWithModifier useKeyPress option Aug 22, 2024
@moklick moklick added the react-docs Issues belonging to the reactflow website label Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
react-docs Issues belonging to the reactflow website
Projects
None yet
Development

No branches or pull requests

3 participants