Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carousel: Don't need to use clickAllowed anymore #4357

Closed
7iomka opened this issue Jun 5, 2023 · 1 comment
Closed

Carousel: Don't need to use clickAllowed anymore #4357

7iomka opened this issue Jun 5, 2023 · 1 comment

Comments

@7iomka
Copy link
Contributor

7iomka commented Jun 5, 2023

What package has an issue

@mantine/carousel

Describe the bug

The latest Embla handles this automatically (davidjerleke/embla-carousel#423)

But your source code contains missed property
https://github.com/mantinedev/mantine/blob/master/src/mantine-carousel/src/CarouselSlide/CarouselSlide.tsx#LL41C24-L41C38

if (ctx.embla?.clickAllowed()) {
   onClick?.(event);
}

Now clickAllowed is removed (I can't find it in the documentation either).

Since users can use versions 7.x and 8x at the same time (I am not sure which version removed this feature yet),
I propose to rewrite the above code as follows:

const canAutoHandleClick = typeof ctx.embla?.clickAllowed === 'undefined';

if(!canAutoHandleClick) {
  if(ctx.embla?.clickAllowed?.()) {
      onClick?.(event);
  }
} else {
   onClick?.(event);
}

Someone please do a PR with this little change.

This will unlock the ability to update users who want to use the current version of the carousel.

The funny thing is that carousel author was probably in such a hurry to roll out updates that now rc versions are installed with normal yarn install command (including plugins), so number of users who will potentially get an error
image

when using mantine will be more than can be expected.

What version of @mantine/hooks page do you have in package.json?

latest

If possible, please include a link to a codesandbox with the reproduced problem

No response

Do you know how to fix the issue

None

Are you willing to participate in fixing this issue and create a pull request with the fix

None

Possible fix

No response

@rtivital
Copy link
Member

Fixed in 6.0.17 – clickAllowed is no longer called

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants