Skip to content

Commit

Permalink
Fix bug when using data-combobox-case-sensitive="no" and data-combobo…
Browse files Browse the repository at this point in the history
…x-search-option="beginning"
  • Loading branch information
nico3333fr committed Jan 3, 2018
1 parent 38a0571 commit c4c59e1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
node_modules/

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
desktop.ini
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "This jQuery plugin will transform and enhance a text input with a datalist into a shiny input with autocomplete, and accessible.",
"homepage": "https://a11y.nicolas-hoffmann.net/autocomplete-list/",
"main": "jquery-accessible-autocomplete-list-aria.js",
"version": "1.5.5",
"version": "1.5.6",
"keywords": [
"Accessibility",
"ARIA",
Expand Down
16 changes: 10 additions & 6 deletions jquery-accessible-autocomplete-list-aria.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ $(document).ready(function() {

/*
* jQuery accessible and keyboard-enhanced autocomplete list
* @version v1.5.4
* @version v1.5.6
* Website: https://a11y.nicolas-hoffmann.net/autocomplet-list/
* License MIT: https://github.com/nico3333fr/jquery-accessible-autocomplete-list-aria/blob/master/LICENSE
*/
Expand Down Expand Up @@ -148,13 +148,17 @@ $(document).ready(function() {
if (
(
$combobox_search_option === 'containing' &&
($combobox_case_sensitive === 'yes' && (tablo_suggestions[index_table][i].indexOf(value_to_search) >= 0)) ||
($combobox_case_sensitive === 'no' && (tablo_suggestions[index_table][i].toUpperCase().indexOf(value_to_search.toUpperCase()) >= 0))
(
($combobox_case_sensitive === 'yes' && (tablo_suggestions[index_table][i].indexOf(value_to_search) >= 0)) ||
($combobox_case_sensitive === 'no' && (tablo_suggestions[index_table][i].toUpperCase().indexOf(value_to_search.toUpperCase()) >= 0))
)
) ||
(
$combobox_search_option === 'beginning' &&
($combobox_case_sensitive === 'yes' && tablo_suggestions[index_table][i].substring(0, value_to_search.length) === value_to_search) ||
($combobox_case_sensitive === 'no' && tablo_suggestions[index_table][i].substring(0, value_to_search.length).toUpperCase() === value_to_search.toUpperCase())
(
($combobox_case_sensitive === 'yes' && tablo_suggestions[index_table][i].substring(0, value_to_search.length) === value_to_search) ||
($combobox_case_sensitive === 'no' && tablo_suggestions[index_table][i].substring(0, value_to_search.length).toUpperCase() === value_to_search.toUpperCase())
)
)
) {
$suggestions.append('<div id="suggestion-' + index_table + '-' + counter + '" class="js-suggestion ' + $combobox_prefix_class + 'suggestion" tabindex="-1" role="option">' + tablo_suggestions[index_table][i] + '</div>');
Expand Down Expand Up @@ -362,4 +366,4 @@ $(document).ready(function() {

}

});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "jQuery Accessible Autocomplete List, using ARIA",
"name": "jquery-accessible-autocomplete-list-aria",
"description": "This jQuery plugin will transform and enhance a simple text input with a datalist into a wonderful and shiny input with autocomplete, and accessible.",
"version": "1.5.5",
"version": "1.5.6",
"main": "jquery-accessible-autocomplete-list-aria.js",
"keywords": [
"Accessibility",
Expand Down

0 comments on commit c4c59e1

Please sign in to comment.