Skip to content

Commit 58b023c

Browse files
authored
fix(dropdown): autocomplete in chrome does not support "off"
Chrome based Browsers ignore autocomplete='off' Read their reasons here bugs.chromium.org/p/chromium/issues/detail?id=468153#c164 Unfortunately this leads into having the search input field in a dropdown getting those autocompletes as well. As the above mentioned comment mentions, this PR set a semantic name as autocomplete value instead of "off" when the browser is chromium based.
1 parent b1765a1 commit 58b023c

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/definitions/modules/dropdown.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ $.fn.dropdown = function(parameters) {
372372
module.verbose('Adding search input');
373373
$search = $('<input />')
374374
.addClass(className.search)
375-
.prop('autocomplete', 'off')
375+
.prop('autocomplete', module.is.chrome() ? 'fomantic-search' : 'off')
376376
.insertBefore($text)
377377
;
378378
}
@@ -3379,6 +3379,9 @@ $.fn.dropdown = function(parameters) {
33793379
bubbledIconClick: function(event) {
33803380
return $(event.target).closest($icon).length > 0;
33813381
},
3382+
chrome: function() {
3383+
return !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
3384+
},
33823385
alreadySetup: function() {
33833386
return ($module.is('select') && $module.parent(selector.dropdown).data(moduleNamespace) !== undefined && $module.prev().length === 0);
33843387
},

src/definitions/modules/search.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ $.fn.search = function(parameters) {
118118
.on(module.get.inputEvent() + eventNamespace, selector.prompt, module.event.input)
119119
;
120120
$prompt
121-
.attr('autocomplete', 'off')
121+
.attr('autocomplete', module.is.chrome() ? 'fomantic-search' : 'off')
122122
;
123123
}
124124
$module
@@ -402,6 +402,9 @@ $.fn.search = function(parameters) {
402402
animating: function() {
403403
return $results.hasClass(className.animating);
404404
},
405+
chrome: function() {
406+
return !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime);
407+
},
405408
hidden: function() {
406409
return $results.hasClass(className.hidden);
407410
},

0 commit comments

Comments
 (0)