Arne Claassen
Arne Claassen

Reputation: 14394

Prevent chrome autosuggest list

I'm using a bootstrap date-picker and with a recent update to Chrome, it started super-imposing a suggestion dropdown on top of the date-picker like this:

Covered Date Picker

I've tried the

autocomplete="nope"

and

autocomplete="new-password"

suggestions for disabling auto-fill, but neither worked. Mind you, there is no autofill happening, it's only the suggestion list that is popping up and only after clicking on the input, so I don't know if this would even be governed by autocomplete.

Upvotes: 3

Views: 1508

Answers (3)

Stevenfowler16
Stevenfowler16

Reputation: 1000

Adding autocomplete="off" attribute will disable autocomplete for an input that isn't a username or password field

<input type="text" autocomplete="off"/>

MDN Note: This link states that turning off autocomplete breaks WCAG 1.3.5 but I'm not sure that is entirely true. Going to discuss with them.

Upvotes: 3

code passionate
code passionate

Reputation: 108

Workaround :

$('#Name').on('mouseup keyup', function () {
            var val = $('#Name').val();
            val = val.length;
            if (val === 0) {
                $('#Name').attr('autocomplete', 'on');
            }
            else {
                $('#Name').attr('autocomplete', 'new-password');
            }
        }).on('mousedown keydown', function () {
            var val = $('#Name').val();
            var length = val.length;
            if (!length) {
                $('#Name').attr('autocomplete', 'new-password');
            }
        })

Upvotes: -1

Alex
Alex

Reputation: 2126

Try adding this to each input field that you have:

role="presentation" autocomplete="nope" 

For me it works. Tested on Chrome Version 66.0.3359.181 (Official Build) (64-bit)

Upvotes: 5

Related Questions