fix: prevent context menu highlight from persisting for touch input #2297
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.
When using touch input with the context menu, all of the previously clicked context menu items remain highlighted when the context menu is reopened (see first screen recording below, tested on Chrome and Edge). This change ensures that the most recently clicked item will be returned to the non-active state after the event fires. I think the root cause of the issue is that the
pointerenter
andpointerleave
don't both fire for touch input so the accounting ofactiveMenuItem
is not working the same way as it does for mouse events. I tried settingtouch-action: none
on the menu items as a alternative solution, but that did not work.Screen Recording of Previous Behavior:
before_context_menu_fix.webm
Screen Recording of Behavior After Proposed Change:
after_context_menu_fix.webm