fix: prevent page hotkeys firing with opened YTDialog [#768] #992
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: #768
The rootcase of the issue is a way of hotkeys declaration via hotkeys-js.
Each hotkey is declared in some scope. Now that scope stays the same when any modal windows opens. That means that hotkeys from the page could be triggered with opened modal window, which might lead to unforeseen results.
The obvious solution here is switching hotkeys scope once any modal window become visible. That prevent page hotkeys from firing.
So we need to modify all code which shows any king of modal windows and add there a scope switch.
Also, there are a lot of direct usage of
Dialog
andModal
components from@gravity-ui/uikit
. I think we need to introduce wrappers for them and switch scope there. Let's name themYTDialog
andYTModal
.