-
-
Notifications
You must be signed in to change notification settings - Fork 333
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
[Dropdown, Search] Support to ignore Diacritics on search #422
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…espect diacritics on select-tag-sorting
lubber-de
added
type/feat
Any feature requests or improvements
state/awaiting-reviews
Pull requests which are waiting for reviews
state/awaiting-docs
Pull requests which need doc changes/additions
tag/sui-issue
Taken from an existing Issue/PR of SUI
labels
Jan 24, 2019
y0hami
approved these changes
Jan 24, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This was referenced Jan 24, 2019
lubber-de
added
state/has-docs
A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo
and removed
state/awaiting-docs
Pull requests which need doc changes/additions
labels
Jan 29, 2019
y0hami
pushed a commit
to fomantic/Fomantic-UI-Docs
that referenced
this pull request
Jan 29, 2019
…ignoreDiacritics' Added examples for dropdown and search option `ignoreDiacritics` as of fomantic/Fomantic-UI#422
prudho
approved these changes
Jan 30, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ColinFrick
approved these changes
Jan 30, 2019
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
y0hami
removed
state/awaiting-reviews
Pull requests which are waiting for reviews
labels
Jan 30, 2019
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
lang/javascript
Anything involving JavaScript
state/has-docs
A issue/PR which requires documentation changes and has the corresponding PR open in the docs repo
tag/sui-issue
Taken from an existing Issue/PR of SUI
type/feat
Any feature requests or improvements
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds the option
ignoreDiacritics
(defaultfalse
to stay backward compatible) to the dropdown and search module.When activated, searches will also match results for base diacritic letters. For example when searching for 'a', it will also match 'á' or 'â' or 'å' and so on...
It will also ignore diacritics for the searchterm, so if searching for 'ó', it will match 'ó', but also 'o', 'ô' or 'õ' and so on...
For the dropdown module i also optimized the sorting method to sort
<option>
values to make sure Diacritics Values are ignored in sorted order. See screenshots belowI implemented the easiest, shortest and most effective solution by using the
String().normalize()
method.As unfortunately IE does not support this, the modules will check support at initialization time and reset the
ignoreDiacritics
setting accordingly, so it behaves as before in such case.There exists a polyfill to also support IE, so this will be mentioned in the console if needed.
Testcase
http://jsfiddle.net/t23uewyn/
Screenshot
Searching
Sorting dropdown
<option>
Closes
Semantic-Org/Semantic-UI#3287
Semantic-Org/Semantic-UI#3577
Semantic-Org/Semantic-UI#4287
Semantic-Org/Semantic-UI#5213
Semantic-Org/Semantic-UI#6793