Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

Enable setting the first option in the list as active.#1796

Closed
Joshuan92 wants to merge 2 commits into
selectize:masterfrom
Joshuan92:master
Closed

Enable setting the first option in the list as active.#1796
Joshuan92 wants to merge 2 commits into
selectize:masterfrom
Joshuan92:master

Conversation

@Joshuan92

Copy link
Copy Markdown

No description provided.

@famoser

famoser commented Apr 21, 2022

Copy link
Copy Markdown

When the user types into the search bar, the first item is always highlighted. When the user then uses backspace (for example, to correct a typo), the same item stays highlighted even though it may not be the top-most item anymore. This is arguably confusing UX.

For example, the user types "Anna", highlighting the person named Anna. Then the user uses backspace to correct a typo. When the user pressed backspace twice (resulting in "An" as a search query), Anna remains highlighted even though there could be many more persons before (for example "Anastasia").

This option opts-in to always highlight the first element in the search results, independent of whether the user used backspace or not.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days

@famoser

famoser commented Sep 21, 2022

Copy link
Copy Markdown

Could the maintainers please indicate whether they intend to review/merge this, or should I close this PR? This is still a concern from my point of view. Thanks!

@risadams risadams left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dist files should not be modified here. they will be reset during a build

Comment thread src/selectize.js
}
}
// activate
self.hasOptions = results.items.length > 0 || ( has_create_option && self.settings.showAddOptionOnCreate ) || self.settings.setFirstOptionActive;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: We should look at a cleanup of these if checks into something that is both easier to understand as a dev, and avoids edge cases

CHORE (testing, documentation): Do you have any updates to unit tests or an example that can show the expected behavior?

risadams added a commit that referenced this pull request Sep 22, 2022
risadams added a commit that referenced this pull request Sep 22, 2022
@risadams

Copy link
Copy Markdown
Contributor

copied and merged in #1874

@risadams risadams closed this Sep 22, 2022
@famoser

famoser commented Sep 23, 2022

Copy link
Copy Markdown

Thank you a lot @risadams !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants