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

🚀 Feature: Allow an onClick option for clicking emojis #136

Closed
3 tasks done
JoshuaKGoldberg opened this issue May 20, 2023 · 0 comments · Fixed by #137
Closed
3 tasks done

🚀 Feature: Allow an onClick option for clicking emojis #136

JoshuaKGoldberg opened this issue May 20, 2023 · 0 comments · Fixed by #137
Assignees
Labels
type: feature New enhancement or request 🚀

Comments

@JoshuaKGoldberg
Copy link
Owner

Bug Report Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have pulled the latest main branch of the repository.
  • I have searched for related issues and found none that matched my issue.

Overview

Right now, emojis are not interactive: the user can't click, drag, etc. with them. As @ian-craig said in #1:

No emoji overlay is complete without the ability to interact with them.

The most straightforward form of interaction I can imagine is adding a click handler. Consumers should be able to specify an onClick function that takes in an actor.

A few implementation detail notes:

  • For accessibility, this means emojis should always be an interactive element (i.e. a <button> for this type of interaction). I think removing the tagName option is therefore reasonable.
  • Let's make this a general events option with an onClick property, rather than a specific onClick option. We'll eventually want more event handlers than just clicks.
emojisplosion({
	events: {
		onClick(actor) {
			actor.update({
				opacity: 1,
				velocity: {
					y: actor.velocity.y - 1,
				},
			});
		},
	},
});

Additional Info

Consider this issue to be a precursor/lead-in to #1. Once we have this issue's infrastructure for an events option added, adding in drag handlers should be a natural next step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New enhancement or request 🚀
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant