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

feat: allow layers to utilise CoreEventHandler mouseleave options #705

Merged
merged 2 commits into from
Oct 24, 2024

Conversation

itsbjoern
Copy link
Contributor

I noticed that removeHoverOnMouseleave wasn't working in the Layers, to get this working I basically just piggy-backed on the same option that is used in the core package and applied the relevant listener.

if (this.derived.options.removeHoverOnMouseleave) {
  unbindMouseleave = this.addCraftEventListener(
    el,
    'mouseleave',
    (e) => {
      e.craft.stopPropagation();
      layerStore.actions.setLayerEvent('hovered', null);
    }
  );
}

Not 100% sure on the change of adding the option to the type of the CoreEventHandlers but as far as I can tell that resolves any type issues on the derived handler type.

Also, as part of it I snuck in a small fix, as far as I can tell the mouseleave listener was never cleaned up in core because it was actually never assigned, so I added this as part of this PR.

Copy link

changeset-bot bot commented Sep 27, 2024

🦋 Changeset detected

Latest commit: 4a20cff

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@craftjs/core Patch
@craftjs/layers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Sep 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
craftjs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 27, 2024 3:29pm

Copy link
Owner

@prevwong prevwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, thank you! 🚀

@prevwong prevwong merged commit 2f133d9 into prevwong:main Oct 24, 2024
2 checks passed
@github-actions github-actions bot mentioned this pull request Oct 23, 2024
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

Successfully merging this pull request may close these issues.

2 participants