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 Request: Allow users to define event listeners for the search bar #944

Open
alfalfasprout opened this issue Aug 15, 2024 · 2 comments

Comments

@alfalfasprout
Copy link

Hello,

Thank you for creating and maintaining this package! My team and I use it within our application and have found it very useful.

We would find it super helpful to be able to define event listeners for the search bar in the Picker component. We'd like to stop some event propagation triggering keyboard shortcuts in our parent app, but are unable to do this as the Picker component is contained in a shadow DOM.

What is the process for contributing to this package, and what's the average time it takes to get a feature integrated if I make a PR for it? I am happy to contribute to this package myself, but need an idea of timeframes to report back to my team so we can make sure it aligns with our planning.

Thank you!

@Chinimala
Copy link

Hello, this package seems no longer maintained / the issues/PRs are not reviewed.

However, at the place you define keyboard shortcuts in the parent app, in the keyboard event listener, you can stop the process if event.target.tagName === 'EM-EMOJI-PICKER'.

And if you want to define new shortcuts inside the emoji picker search input for example, you can do:

const picker = new Picker(...);
setTimeout(() => {
  picker.shadowRoot.querySelector('.search input').addEventListener('keydown', () => { /* your event listener */ }, true);
});

That's how I added a new shortcut to close the emoji picker from inside.

@alfalfasprout
Copy link
Author

Hello @Chinimala, thank you so much for this comment! I did end up doing pretty much this, but was looking for a better solution. Have a lovely day!

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