zurb / tribute

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

Stop searching once selection is made if `allowSpaces` is true. Seen in version 5.1.1 and higher. #606

Open and-megan opened 3 years ago

and-megan commented 3 years ago

It looks like this bug was introduced in version 5.1.1. I fiddled around with the version in my codepen link and everything works as expected in version 5.1.0 and then breaks in subsequent versions.

How can we reproduce this bug?

  1. Set allowSpaces: true in configuration
  2. Attach tribute to a text area
  3. Search for a value, e.g. type @Phil
  4. Select user, e.g. Phil Heartman, from list
  5. Continue typing, e.g. "is not the famous voice actor"
  6. Tribute continues searching in values using text typed after the replaced selection text, i.e. searches values for "Phil Heartman is not the famous voice actor"

What did you expect to happen? Tribute stops trying to match typed input against values once a selection is made.

What happened instead? Tribute attempts to match typed string until another trigger character is typed.

Link (jsfiddle/plunkr/codepen) or Screenshot: Codepen: https://codepen.io/andmegan101/pen/qBqOYyN

greenfork commented 3 years ago

I can reproduce, same problem

gurgeous commented 3 years ago

Can confirm - this blocks allowSpaces from being used

tomek-swienty commented 3 years ago

Confirmed :(

nseb commented 2 years ago

+1

MoritzGiessmann commented 1 year ago

Same. Did anyone come up with a solution yet?

datherton15 commented 1 year ago

Same. Any timeline on resolution?

MoritzGiessmann commented 1 year ago

I did come up with a solution, but I had to change the whole tribute.js and introduce a new state that resolves after inserting a suggestion. Not elegant and not worth posting.

datherton15 commented 1 year ago

I did come up with a solution, but I had to change the whole tribute.js and introduce a new state that resolves after inserting a suggestion. Not elegant and not worth posting.

@MoritzGiessmann Nice...elegant or not, any port in a storm. Could you publish your version of the tribute.js? I have been tracing the code and trying to figure out best method to adjust /implement a solution but again, just logging at this point.

datherton15 commented 1 year ago

Doing comparison between versions 5.1.0 and 5.1.1 points to issue with line 1452 or essentially the "<li>No Match Found!</li>" line. Resetting to "" works; In version 5.1.3, if do search for "<li>No Match Found!</li>" and replace with "" it works BUT