Skip to content

feat: add configurable double-tap seek with ytp-seek visual feedback#4168

Open
heidevary wants to merge 4 commits into
code-charity:masterfrom
heidevary:master
Open

feat: add configurable double-tap seek with ytp-seek visual feedback#4168
heidevary wants to merge 4 commits into
code-charity:masterfrom
heidevary:master

Conversation

@heidevary

Copy link
Copy Markdown

Summary

Implements configurable double-tap seek distances for touch devices, addressing issue #4132.

This PR follows the maintainer's guidance from the issue discussion:

  • Touch inputs added to shortcuts.js - the touchend listener is integrated into the existing shortcutsListeners system
  • ytp-seek-* visual classes modified through the DOM - toggles ytp-seek-forward-bump / ytp-seek-backward-bump on the player element, and triggers YouTube's ytp-doubletap-ui overlay
  • Uses player.seekTo() - as the maintainer specified, not seekBy()
  • event.preventDefault() + event.stopPropagation() - prevents YouTube's default double-tap behavior when custom mode is active

Features

Three seek modes (as requested in the issue):

  1. Default - YouTube's native behavior (no interception)
  2. Fixed distance - user-configurable seek distance (1-60 seconds), same amount every tap
  3. Progressive distance - separate distances for double-tap, triple-tap, and quadruple-tap

Changes

File Change
shortcuts.js Add touchend listener to shortcutsListeners, doubleTapSeek() function, modify shortcutsInit()
menu/skeleton-parts/player.js Add Double-tap seek section with mode selector and distance sliders
_locales/en/messages.json Add i18n labels for new settings
tests/unit/double-tap-seek.test.js Jest tests for seek logic, boundary checks, progressive mode, visual feedback

/claim #4132

heidevary added 2 commits July 9, 2026 03:27
- Add touchend listener to shortcuts.js for double-tap detection on player
- Support 3 modes: default, fixed distance, progressive distance
- Use player.seekTo() and toggle ytp-seek-* visual classes
- Add menu controls, i18n labels, and Jest tests

Closes code-charity#4132
- Only add new i18n keys without reformatting existing entries
- Remove version numbers from code comments
The touchend handler was calling preventDefault() on all touch events
in the player area, which broke play/pause, fullscreen, and settings
buttons. Added a check to skip taps on .ytp-chrome-bottom, .ytp-button,
and other control elements.
@heidevary

Copy link
Copy Markdown
Author

Self-Check Fix

After reviewing my own PR, I found and fixed one issue:

shortcuts.js - Fixed preventDefault() breaking touch controls

Problem: The touchend handler called event.preventDefault() and event.stopPropagation() on all touchend events in the player area. This would break touch interactions with player controls (play/pause button, fullscreen, settings gear, etc.).

Fix: Added a check before the preventDefault logic:

const target = event.target;
if (target && target.closest && target.closest('.ytp-chrome-bottom, .ytp-chrome-top, .ytp-settings-menu, .ytp-popup, .ytp-button, button, a')) return;

This skips interception when the touch target is inside a player control element, allowing normal touch interaction while still enabling double-tap seek on the video surface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant