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

Be able to go to category even while search is active #931

Open
Chinimala opened this issue Jul 24, 2024 · 0 comments
Open

Be able to go to category even while search is active #931

Chinimala opened this issue Jul 24, 2024 · 0 comments

Comments

@Chinimala
Copy link

Hello,

In our apps, we have to add a patch to match the following expected result.

Context :

  • Search results are displayed
  • Click on a category button

Actual result: Nothing happens

Expected result: Search is cleared, emojis from the clicked category are displayed.

Would it be possible to make it the default behavior, or add an option for it?
I'll create a PR as a proposal.

Here is our patch:

const categoryButtons = picker.shadowRoot.querySelectorAll('#nav > div > button');
categoryButtons.forEach(categoryButton => {
    categoryButton.addEventListener('click', () => {
        const clearSearchButton = picker.shadowRoot.querySelector('.search > button');
        if (clearSearchButton) {
            clearSearchButton.click();
            // Reclick button after clearing search to go to category
            setTimeout(() => categoryButton.click());
        }
    });
});

Before:

emoji-mart-go-to-category-while-search-active-before.mp4

After:

emoji-mart-go-to-category-while-search-active-after.mp4
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

1 participant