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

Highlight only works for the first typed letter #1098

Closed
skimi opened this issue Jul 1, 2016 · 11 comments
Closed

Highlight only works for the first typed letter #1098

skimi opened this issue Jul 1, 2016 · 11 comments
Milestone

Comments

@skimi
Copy link
Contributor

skimi commented Jul 1, 2016

The highlight only highlights the first or first and second letterz (if you are fast) of the input text.
Afterward anything you type is ignored.

Also, if you copy paste a string in the input it will be highlighted completely but will ignore anything you type after that string.
This must be related to some kind of timing issue.

highlight

Steps to reproduce:

  1. On http://selectize.github.io/selectize.js/ Email Contacts example
  2. Type "brian"
  3. Only "b" or "br" is highlighted

Expected result:
Brian should be highlighted in both the email and the name

Actual result:
Only "b" or "br" is highlighted

Might be related:
The highlight <span class="highlight"> gets wrapped inside other <span class="highlight"> at each new highlight instead of resetting the string.

skimi added a commit to skimi/selectize.js that referenced this issue Jul 2, 2016
@skimi
Copy link
Contributor Author

skimi commented Jul 2, 2016

Ok, I've debugged a bit more.

The bug is due to the way the highlight function splits the string to insert the <span class="highlight">. After the split, every letter is on its own line and is considered a full word by the function.

In newer version of the highlight function they have added a removeHighlight() function that solves the problem by reverting all highlighted strings to their original state.

I would simply update the highlight script to the last version but the last version has changed it's matching system and it does not pass the js strict mode so it can't be commited as is into selectize repo.

Anyway I've made a minimal commit where I've just updated selectize version to include their removeHighlight() and edited it to pass strict mode.

@SantzDesign
Copy link

Hey guys!

I bet this is already fixed since Jonathan closed it, but I wanted to add to what Skimi pointed out, that a second issue is that since highlights don't get cleared, you end up with multiple <span>s wrapping the same or different highlighted letters. Check screenshot.

selectizehighlightbug

I'm using Safari Version 9.1.2 (11601.7.7) on OS X 10.11.6 (15G31).

@skimi
Copy link
Contributor Author

skimi commented Jul 21, 2016

Yep it'll be fixed in 0.12.3. Previous highlights will always get cleared before new ones are added.

@Larivact
Copy link

When will 0.12.3 be released? It's annoying to download the latest release only to figure out that the highlighting is completely broken. And now so for over a month, despite a fix existing for 26 days.

@joallard
Copy link
Member

@Larivact If you need master bugfixes, then use master. Else the new release will come soon.

@imolorhe
Copy link

@joallard would I get the fix if I download the code in the master branch?

@joallard
Copy link
Member

@imolorhe correct!

@imolorhe
Copy link

Yeah I figured it out later. I had to build it to get the changes. The
changes aren't already built into the dist folder in the master branch.

On Mon, Aug 22, 2016, 8:59 PM Jonathan Allard notifications@github.com
wrote:

@imolorhe https://github.com/imolorhe correct!


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1098 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEZQj4iYAewnlmYDjHJpRzFRa5O8JlIrks5qif-vgaJpZM4JDJle
.

Regards,
Samuel
http://about.me/sirmuel

@Wardrop
Copy link

Wardrop commented Aug 23, 2016

@skimi This ought to be re-opened. I've just built from master and the highlighting is still buggy. If you type something, and then backspace it, the highlighting for the first letter remains until you type something else.

@skimi
Copy link
Contributor Author

skimi commented Aug 23, 2016

@Wardrop Yep, you are correct. When clearing the input the last highlight remains present.
Though, for the sake of clarity, could you create a new issue?

@skimi skimi reopened this Aug 23, 2016
@skimi skimi closed this as completed Aug 23, 2016
@joallard
Copy link
Member

+1 @skimi @Wardrop Open a new issue and we'll try to get it sorted before 0.12.3

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

6 participants