question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Carousel: No listeners for mobile carousels with `data-bs-ride=boolean`

See original GitHub issue

Prerequisites

Describe the issue

Seems to be there for quite a long time.

The main issue is that if data-bs-ride is set to anything but carousel, the constructor() isn’t called (whereas there’s a check inside to avoid launch cycle()). This leads to unset (at least) touch listeners which, in mobile views, is kinda weird IMO.

screen-recording

I don’t have the time to test it atm, but I think there’s only a change on the selector would do the trick ?

Reduced test cases

Go on https://twbs-bootstrap.netlify.app/docs/5.2/components/carousel/#with-controls (which works well with mobile listeners) Go on https://twbs-bootstrap.netlify.app/docs/5.2/components/carousel/#with-indicators (which is broken with mobile listeners until we click one button)

What operating system(s) are you seeing the problem on?

Windows

What browser(s) are you seeing the problem on?

Chrome, Firefox

What version of Bootstrap are you using?

5.2.2 (current_main_branch)

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:2
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
patrickhlaukecommented, Oct 20, 2022

The solution is real simple if we are sure we want this attitude 😃 #37295 (comment)

i think it’s even simpler than that: no need to check if there’s a data-bs-ride attribute at all, just attach the touch listeners on initialisation, all the time, just like with mouse listeners. touch functionality is not dependent on whether it autoscrolls or scrolls after first interaction.

1reaction
patrickhlaukecommented, Oct 17, 2022

However, @louismaximepiton pointed something here. The carousel touch listeners are registered after the initialization, in contradiction with click event listeners that are registered on document

ah yes, event listeners should all register at the same time at initialisation, not just after first interaction

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mobile Carousels | Intercom
Send dynamic carousel messages that prompt users to enable push notifications, location services, camera access, and more—even after they've been onboarded.
Read more >
Carousels on Mobile Devices - Nielsen Norman Group
Zara.com used no carousel signifiers to indicate to users that they can access more content by swiping horizontally. The carousel was self- ...
Read more >
Accessible Mobile Carousels - Mobile Office Hours – April 2019
Watch this technical discussion about our learnings from implementing an Accessible Android Carousel and why user empathy was our biggest ...
Read more >
Mobile Carousels by Intercom - YouTube
Perfect for onboarding and mobile adoption, use Mobile Carousels to welcome new users to your mobile app, make announcements, request device ...
Read more >
Mobile friendly carousel with touch and pointer events
Note: The touchdown and touchup in this tutorial should be replaced by touchstart and touchend!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found