The Problem
I am trying to set the HTML attribute auto-complete="off"
on an input element with the class slds-input
. For some reason the template always converts this to autocomplete="true"
in rendering.
I have created a custom search field to search for sObjects, and so the browser autocomplete behavior is obviously unhelpful, and if this were regular html I could just include the autocomplete
attribute with the value off
, but aura doesn't seem to let me.
One answer I found suggested using html-autocomplete="off"
, so I also tried that, and when I do that the attribute simply isn't rendered at all.
What I've tried
- I tried including
autocomplete="off"
andhtml-autocomplete="off"
in the input tag - I tried including
autocomplette="off"
andhtml-autocomplete="off"
in the form tag surrounding the input tag - I tried adjusting the
aria-autocomplete
value (that did nothing, not that I really expected it to, but I wanted to at least try). - In this PDF of the aura docs the html attribute
autocomplete
is not mentioned. - I've found a list of supported HTML tags in aura, but no list of supported attributes
- I can't find anything about this behavior in the lightning docs, and it's very difficult to google for because of the autocomplete lightning/aura element
Is there any way to do this? Or documentation about this behavior?
Code sample:
This:
<aura:component>
<input type="text" autocomplete="off" />
</aura:component>
will come out in the final HTML as this:
<input type="text" autocomplete="true" data-aura-rendered-by="5:0">