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

Tab key always selects the current item regardless of the selectKeys option #191

Open
tilmanschweitzer opened this issue Mar 9, 2021 · 2 comments

Comments

@tilmanschweitzer
Copy link

I'd expect that only keys in the option selectKeys trigger the selection, but I can't disable the tab key. I guess these lines are responsible for the issue.

https://github.com/afry/quill-mention/blob/master/src/quill.mention.js#L103-L107

Thanks for this great quill module.

@MadSpindel
Copy link
Member

Yes, maybe you can provide a PR to fix this? 👍

@jaytimbadia
Copy link

I'd expect that only keys in the option selectKeys trigger the selection, but I can't disable the tab key. I guess these lines are responsible for the issue.

https://github.com/afry/quill-mention/blob/master/src/quill.mention.js#L103-L107

Thanks for this great quill module.

Hey,

Hope you are good.

I was using this module and what I want is, I want to trigger dropdown when Tab is pressed.

I am using with react and my code is

`mentionModule = {
allowedChars: /^[A-Za-z\s]*$/,
mentionDenotationChars: ["@", "#"],
selectKeys: [27],
source: function (searchTerm, renderList, mentionChar) {
let values;
console.log("mentionchar", mentionChar);

  if (mentionChar === '@') {
    values = atValues;
  } else if (mentionChar === "#") {
    values = hashValues;
  } else {
    values = randomValues;
  }

  if (searchTerm.length === 0) {
    renderList(values, searchTerm);
  } else {
    const matches = [];
    for (let i = 0; i < values.length; i++)
      if (~values[i].value.toLowerCase().indexOf(searchTerm.toLowerCase()))
        matches.push(values[i]);
    renderList(matches, searchTerm);
  }
},

};`

But this is not working, when I am pressing tab, its not doing anything.

Can you please help?

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

3 participants