Skip to content

Improve touch controls for dash quality selector #4750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

MarmadileManteater
Copy link
Contributor

@MarmadileManteater MarmadileManteater commented Mar 6, 2024

Improve touch controls for dash quality selector

Pull Request Type

  • Bugfix
  • Feature Implementation
  • Documentation
  • Other

Related issue

MarmadileManteater#239

Description

The dash quality selector does not respond well to touch input unlike the legacy and audio quality selectors. The handleClick event is being called, but the way that is being called on touch input causes e.target to reflect a different element than the one actually tapped on. This causes the quality selector to seem like it is ignoring user input when, it is just treating most taps as if they were on the current quality label (which causes the click handler to return immediately).

This PR addresses this by adding a touchstart event to the button element which simply calls handleClick with the appropriate target. Due to the fact that the quality selector is typically hidden and shown by a hover psuedo class, code was also added to the touchstart event to handle flipping the vjs-lock-showing class.

This PR also sets the max-block-size for the dash-quality selector on narrow displays in order to enable scrolling the list of qualities in the same way as the audio quality selector.

Screenshots

the touch responsiveness

before after
before after-everything

the scrollability

before after
before after

Testing

  1. Ensure dash is the preferred format
  2. Open a video
  3. Ensure the dash quality selector hasn't changed at all on mouse input
  4. Ensure the dash quality selector behaves the same way with touch input as mouse input

Desktop

  • OS: Windows 10
  • OS Version: Pro Version 21H2 Installed on ‎4/‎3/‎2022 OS build 19044.1889 Experience Windows Feature Experience Pack 120.2212.4180.0
  • FreeTube version: 672803d

Additional context

To be clear, it is possible to make the dash quality selector "work" (kind of) as is, but it requires "hovering" the button by hold tapping before making a quick shorter tap. Simply tapping once doesn't do anything most of the time.

note: I just noticed that the audio / legacy quality selector hides when a quality selection is made. This implementation only hides the selector once the focusexit event triggers. It may be preferable to hide the quality selector when a selection is made more like the other quality selectors on mobile, but I am divided since the dash quality selector tends to be tall enough that it needs to be able to be scroll-able. After adjusting the scroll-ability of the quality selector, I think it makes more sense to replicate the behavior of the existing audio selector and hide the selector after the selection is made.

- Add `touchstart` event to quality button which toggles the `vjs-lock-showing` class used on other quality selectors
- Call `this.handleClick` from touchstart (fixes issue with `e.target` not being correct)

#239
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) March 6, 2024 22:47
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Mar 6, 2024
@MarmadileManteater MarmadileManteater requested review from absidue and PikachuEXE and removed request for absidue March 6, 2024 22:48
PikachuEXE
PikachuEXE previously approved these changes Mar 7, 2024
(just like the other quality selectors do on mobile)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

So idk if this is intentional but shouldnt the speed behave the same as the quality menu? If i tap on speed it will just move up instead of opening the menu for it, like for the qualities

VirtualBoxVM_swb0hDhHGU.mp4

@MarmadileManteater
Copy link
Contributor Author

I think it makes more sense to behave like the other quality controls (legacy & audio). Personally, I find the adjusting playback speed a little clunky. Its acceptable, but I don't think I would want that behavior for the quality selector.

@FreeTubeBot FreeTubeBot merged commit 551b513 into FreeTubeApp:development Mar 10, 2024
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Mar 10, 2024
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Mar 13, 2024
…h-matching-videos

* development:
  Fix handling of video published date in video lists (FreeTubeApp#4752)
  Translated using Weblate (Dutch)
  Translated using Weblate (Chinese (Simplified))
  Bump lefthook from 1.6.4 to 1.6.5 (FreeTubeApp#4758)
  Bump marked from 12.0.0 to 12.0.1 (FreeTubeApp#4757)
  Bump electron from 29.1.0 to 29.1.1 (FreeTubeApp#4756)
  Translated using Weblate (Portuguese)
  Translated using Weblate (Portuguese (Brazil))
  Improve touch controls for dash quality selector (FreeTubeApp#4750)
  Translated using Weblate (Serbian)
  Translated using Weblate (Spanish)
  Translated using Weblate (French)
  Translated using Weblate (German)
  Translated using Weblate (Estonian)
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Mar 13, 2024
* development: (28 commits)
  Fix handling of video published date in video lists (FreeTubeApp#4752)
  Translated using Weblate (Dutch)
  Translated using Weblate (Chinese (Simplified))
  Bump lefthook from 1.6.4 to 1.6.5 (FreeTubeApp#4758)
  Bump marked from 12.0.0 to 12.0.1 (FreeTubeApp#4757)
  Bump electron from 29.1.0 to 29.1.1 (FreeTubeApp#4756)
  Translated using Weblate (Portuguese)
  Translated using Weblate (Portuguese (Brazil))
  Improve touch controls for dash quality selector (FreeTubeApp#4750)
  Translated using Weblate (Serbian)
  Translated using Weblate (Spanish)
  Translated using Weblate (French)
  Translated using Weblate (German)
  Translated using Weblate (Estonian)
  Translated using Weblate (Polish)
  Translated using Weblate (Basque)
  Translated using Weblate (Portuguese (Brazil))
  Translated using Weblate (Portuguese (Brazil))
  Translated using Weblate (Portuguese (Brazil))
  Fix playlists database import and export not using the actual database format (FreeTubeApp#4664)
  ...

# Conflicts:
#	src/renderer/views/Search/Search.js
@MarmadileManteater MarmadileManteater deleted the better-dash-quality-touch branch March 16, 2024 15:50
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.

6 participants