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
Currently, hotkeys supports the ignoreInputs option, which is great for preventing global shortcuts from triggering while typing. However, in many real-world scenarios, we need more granular control.
The Problem:
We are building a rich text editor where shortcuts (like Cmd+Z for undo) are registered globally on the document.
Scenario A: When a user is typing in the main editor body, we want Cmd+Z to trigger our custom undo logic.
Scenario B: If the user moves focus to a comment input or a sidebar text field, we want to ignore the global shortcut and let the browser's default input behavior take over.
Currently, if we set ignoreInputs: true, Scenario A fails. If we set it to false, Scenario B triggers the wrong undo logic.
The Proposal:
Allow ignoreInputs to accept a predicate function, or introduce a filter option. This would allow us to check the event target and decide whether to skip the shortcut based on the UI context.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Currently, hotkeys supports the ignoreInputs option, which is great for preventing global shortcuts from triggering while typing. However, in many real-world scenarios, we need more granular control.
The Problem:
We are building a rich text editor where shortcuts (like Cmd+Z for undo) are registered globally on the document.
Scenario A: When a user is typing in the main editor body, we want Cmd+Z to trigger our custom undo logic.
Scenario B: If the user moves focus to a comment input or a sidebar text field, we want to ignore the global shortcut and let the browser's default input behavior take over.
Currently, if we set ignoreInputs: true, Scenario A fails. If we set it to false, Scenario B triggers the wrong undo logic.
The Proposal:
Allow ignoreInputs to accept a predicate function, or introduce a filter option. This would allow us to check the event target and decide whether to skip the shortcut based on the UI context.
Beta Was this translation helpful? Give feedback.
All reactions