Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !22442

Fix carousel "hover" behavior on touch-enabled devices

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Patrick H. Lauke requested to merge github/fork/patrickhlauke/v4-dev-carousel-touch-fixup into v4-dev Apr 14, 2017
  • Overview 0
  • Commits 3
  • Pipelines 0
  • Changes 3

Currently, mouseenter/mouseleave pause the carousel, but these listeners are not added if it's a touch-enabled device. This causes problems on touch-enabled laptop/desktop devices, or when a mouse is paired with, say, an Android phone/tablet, as then the mouse listeners are not added and the carousel does not pause as it should when the user interacts with the mouse.

This PR modifies the behavior: mouse listeners are always added. Additionally, on touch devices, an extra touchend listener is included. Mouse users on touch-enabled devices now can pause the carousel as expected. If the user interacts with the carousel with the touchscreen, the carousel is now paused for the duration of this._config.interval (plus an extra 500 milliseconds, just to make sure we always wait until the mouse compat events have definitely been fired - which is what made the original code necessary in the first place since touch events also fire a mouseenter compatibility event), and then the cycling is explicitly restarted.

This now allows touchscreen users some time to read/interact with the carousel slide, before cycling is resumed. And it fixes the broken behavior for mouse users on touch-enabled devices too.

Closes #20847 (closed) (but the problem is not limited to Firefox, same happens on, say, Chrome on a touch-enabled device)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/patrickhlauke/v4-dev-carousel-touch-fixup