Giter Club home page Giter Club logo

Comments (7)

jasonk16 avatar jasonk16 commented on June 10, 2024 1

Oh yeah, something like watchFocus would be beneficial. Thanks a lot for coming up with a fix. I'll just go with the hacky solution for now but happy to help if you'd need me to test anything.

from embla-carousel.

davidjerleke avatar davidjerleke commented on June 10, 2024 1

Thanks @jasonk16. It would definitely help if you wouldn’t mind testing as soon as I have a draft ready. I’ll let you know when I have something 👍🏻.

from embla-carousel.

davidjerleke avatar davidjerleke commented on June 10, 2024

Hi @jasonk16,

Thanks for your bug report. Have you seen the example in the docs? Can you reproduce it there? If no, please check how to work with the plugin there.

Best,
David

from embla-carousel.

jasonk16 avatar jasonk16 commented on June 10, 2024

Thanks for your quick reply @davidjerleke. I've reproduced the jumpyness based on the example here, I've just changed the individual items to suit my needs, which is an image container.

from embla-carousel.

davidjerleke avatar davidjerleke commented on June 10, 2024

@jasonk16 thanks! I'll investigate what's going on when possible.

This might be related to anchor tags being elements that can receive focus. If my assumption is correct, the carousel jumps to the slide that is active when the focus event is triggered from a click.

Best,
David

from embla-carousel.

jasonk16 avatar jasonk16 commented on June 10, 2024

Your assumption is correct. I've just tried removing the anchor tags from the cards and it does not jump anymore. Perhaps I could use onClick on divs as a workaround temporarily, but long term I guess its not a good html semantics if those cards are links.

I also tried nesting the anchor tag within the div but I guess the focus still triggers on click. Let me know if theres anything you'd need my help on. Thanks again!

from embla-carousel.

davidjerleke avatar davidjerleke commented on June 10, 2024

Perhaps I could use onClick on divs as a workaround temporarily, but long term I guess it's not a good html semantics if those cards are links.

@jasonk16 you're right about that. It's not good semantics so a solution for this is needed. I'm working on a new option called watchFocus which will enable you to either disable/enable the auto focus feature with a boolean. Alternatively, you will be able to pass your own callback to control when Embla should focus or not: Similar to watchDrag, watchResize and watchSlides.

Unfortunately, until then, you'll have to stick with the hacky solution you mentioned.

Best,
David

from embla-carousel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.