fix: handle Mac trackpad tap-to-click in isSingleLeftClick#9177
Open
okxint wants to merge 1 commit into
Open
Conversation
) Mac trackpad tap-to-click fires mousedown with {button:0, buttons:0}. Consolidate the mouseup and mousedown {0,0} checks into a single `event.type !== 'mousemove'` guard — the only event type where {0,0} should be rejected is mousemove, which signals button release during a drag. Closes videojs#7736
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Fixes #7736.
Mac trackpad tap-to-click fires
mousedownwith{button: 0, buttons: 0}instead of the expected{button: 0, buttons: 1}. The currentisSingleLeftClickhas separate blocks formouseupandmousedownhandling this{0, 0}case — this PR consolidates them into a singleevent.type !== 'mousemove'guard.The
{0, 0}rejection is only meaningful formousemoveevents (detecting button release during a drag). For all other event types (mousedown,mouseup, etc.),{button: 0, buttons: 0}is a valid single left click.This approach was suggested by @gkatsev in #7736 (comment).
Changes
src/js/utils/dom.js: Replaceevent.type === 'mouseup'withevent.type !== 'mousemove'for the{0, 0}check, removing the separatemousedownblockTest plan
mousemove {0,0}→ false,mouseup {0,0}→ true,mousedown {0,0}→ true