Change default behaviour of carousels to make autoplay opt-in
After much head-scratching, I grokked that the carousel component currently:
- autoplays by default after the first interaction (which seems rather pointless/nonsensical)
- allows authors to make the autoplay start right on page load through the
data-bs-ride="carousel"
option - lets authors optionally pause the carousel autplay when hovering over it
- lets authors suppress autoplay altogether (opt-out) by explicitly adding
data-bs-interval="false"
I would argue that this component's behaviour is the exact opposite of what authors would expect (certainly coming from other frameworks, like AMP). The usual approach that, as an author, I'd expect is:
- carousel is static by default
- authors can explicitly opt into autoplaying at page load somehow (e.g. adding some sort of autoplay toggle, like
data-bs-autoplay
, defaulted tofalse
, but authors can set it explicitly totrue
to opt-in) - for autoplaying carousels, stop the autoplay after an interaction (i.e. the user has explicitly clicked somewhere, moved focus into the carousel, is hovering over it) by default (this respects the user's intent by default)
- allow authors to explicitly ignore users hovering over the carousel with the mouse (but don't do it for keyboard) - with added warning that the option should not be used for any kind of interactive slide content, as that will otherwise move the content from under the users' mouse pointer/feet. for this reason, don't offer this option for keyboard/focus, as there it would be even more annoying and potentially lead to focus being lost/reset to the start of the page. maybe call it
data-bs-hoverstop
, which defaults totrue
, but can be suppressed withfalse
admittedly this would now be a breaking change, but i think a change for the better.