You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am developing a rich text editor. When text is selected and a formatting button in the toolbar is clicked, the mobile keyboard closes because the focus shifts to the button. To prevent this, I tried adding event.preventDefault() to onMouseDown, but this doesn't work because usePress employs various other events to change focus, making onMouseDown inaccessible.
It will be great to have a prop named preventFocusOnPress if we cannot have onMouseDown
🤔 Expected Behavior?
There should be a way to prevent focus on buttons.
😯 Current Behavior
There is no way to prevent focus on click of a button
💁 Possible Solution
No response
🔦 Context
In text editors, even when you click a button, the focus should not shift from the main textbox but there is no way to do that in the current button hooks.
💻 Examples
No response
🧢 Your Company/Team
PSPDFKit
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered:
ritz078
changed the title
Prevent focus change on press of a button
Prevent focus on press of a button
Jun 12, 2024
We actually have preventFocusOnPress in useButton already but it is undocumented since it was more for specific use cases (calendar cells, combobox button, etc) and we didn't want it to be misused. I can bring it up with the team to see if we want to pivot on that and expose it fully.
Talked with the team, we are ok with exposing it as public api, will need to document it and mention that it should only be used in particular use cases.
Provide a general summary of the feature here
I am developing a rich text editor. When text is selected and a formatting button in the toolbar is clicked, the mobile keyboard closes because the focus shifts to the button. To prevent this, I tried adding
event.preventDefault()
toonMouseDown
, but this doesn't work becauseusePress
employs various other events to change focus, makingonMouseDown
inaccessible.It will be great to have a prop named
preventFocusOnPress
if we cannot haveonMouseDown
🤔 Expected Behavior?
There should be a way to prevent focus on buttons.
😯 Current Behavior
There is no way to prevent focus on click of a button
💁 Possible Solution
No response
🔦 Context
In text editors, even when you click a button, the focus should not shift from the main textbox but there is no way to do that in the current button hooks.
💻 Examples
No response
🧢 Your Company/Team
PSPDFKit
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: