[Feat]: Trigger event (autoplay:select) on autoplay index update #1048
-
Which variants of Embla Carousel are relevant to this feature request?
Feature descriptionAn event emission on autoplay trigger (i.e. "autoplay:select") to notify listeners when an index change is being driven by the autoplay plugin. We can detect an index change from the select event, but deriving the source of this index change is harder to track when resulting from the autoplay plugin. Additional ContextAs a library wrapper, we intend to provide users with both the event and event type (autoplay/focus/drag/click etc.) for index change callbacks, this includes passing through the underlying mouse/pointer events when an action such as drag is taken. For drag events, we've built a custom plugin to handle this scenario: (https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-carousel/library/src/components/pointerEvents.ts). This event would simplify an autoplay callback equivalent: I am happy to submit a PR with the above if this feature is approved. Before submitting
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @Mitch-At-Work, Thank you for your suggestion. I won't have time to look into this at the time of writing but I don't see why not. I know there's a feature request about adding an option that controls the autoplay direction on the roadmap: It will make it possible for autoplay to go backwards so with that in mind, you might want to consider alternative naming for |
Beta Was this translation helpful? Give feedback.
-
PR raised here, please let me know if we need any additional testing or example updates to land: |
Beta Was this translation helpful? Give feedback.
This feature is available from v8.4.0 and up.