zurb / tribute

ES6 Native @mentions
https://zurb.github.io/tribute/example/
MIT License
2.04k stars 305 forks source link

Backspace to remove a mention is not working in Firefox #330

Open kgrosvenor opened 5 years ago

kgrosvenor commented 5 years ago

How can we reproduce this bug?

  1. Step one
  2. Step two
  3. Step three

What did you expect to happen?

What happened instead?

Link (jsfiddle/plunkr/codepen) or Screenshot: You can fork this Codepen as a base for reproducing your issue: https://codepen.io/mrsweaters/pen/OxxdWv?editors=1010#0

Robin-Thomas-577 commented 5 years ago

Firefox has a bug with contentEditable inside a contentEditable elements. You can turn contentEditable to true in selectTemplate hook. ie:

selectTemplate: () => {
 return <span contenteditable="true"> test </span>
}

This is more of a hack and not a proper sol.

kgrosvenor commented 5 years ago

@robin-philip-thomas doesn't work, Is there any scope for a proper solution for Firefox?

mrsweaters commented 4 years ago

I'm aware of this bug, unfortunately @robin-thomas-e1391 is right, this is a bug in Firefox. The only workaround is to be aware of the template syntax you've selected and detect cursor position around this element. https://stackoverflow.com/questions/2239821/backspace-doesnt-delete-inner-html-tags-of-a-contenteditable-div-in-firefox

Due to the flexibility of custom templates, I don't think that we can do this for you.

kgrosvenor commented 4 years ago

Thanks for the responses, guess we'll have to hope Firefox come up with the content editable fix at some point, will see what i can do in the mean time with this ^