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

[Dropdown, Search] Support to ignore Diacritics on search #422

Merged
merged 2 commits into from
Jan 30, 2019

Conversation

lubber-de
Copy link
Member

@lubber-de lubber-de commented Jan 24, 2019

Description

This PR adds the option ignoreDiacritics (default false 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 below

I 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

Before After
diac_bad diac_good

Sorting dropdown <option>

Before After
image image

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

@lubber-de 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
@lubber-de lubber-de added this to the 2.7.x milestone Jan 24, 2019
Copy link
Member

@y0hami y0hami left a comment

Choose a reason for hiding this comment

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

LGTM

@lubber-de lubber-de added the lang/javascript Anything involving JavaScript label Jan 24, 2019
@lubber-de 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
Copy link
Contributor

@prudho prudho left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@ColinFrick ColinFrick left a comment

Choose a reason for hiding this comment

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

LGTM

@y0hami y0hami merged commit 63a0855 into fomantic:develop Jan 30, 2019
@y0hami y0hami removed state/awaiting-reviews Pull requests which are waiting for reviews labels Jan 30, 2019
@lubber-de lubber-de modified the milestones: 2.7.x, 2.7.2 Jan 30, 2019
@y0hami y0hami mentioned this pull request Feb 4, 2019
@lubber-de lubber-de deleted the diacritics_search branch February 5, 2019 11:23
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants