Lightning component’s .focus() not working

I have an input field:

<ui:inputText aura:id="name-input"/>

With controller code:

var input = cmp.find("name-input");

This gives the error:

Access Check Failed! Component.method():’markup://ui:focus’ is not visible to ‘markup://c:TimeTagCreator {100:0}’.

I can even see that the .focus() method exists, with the output of that console.log(); being:

enter image description here

What is going on here?


You’re getting an Access Check Failure (ACF) here because the focus aura:method on ui:input (which ui:inputText extends) is not marked access=GLOBAL so it is not public available for use. Even though you can see the method defined on the ui:inputText object, the framework will verify access before letting you call it.

You can see more info on ACFs here:

Since it’s still in Beta, don’t use it for anything that will end up in a managed package, but have you tried out lightning:input?

Of course, you can always roll your own using the native <input> tag, but I do think this is something that should be fixed by the framework.


The focus() method of lightning:input also throws an ACF currently, but will be fixed in the Spring ’17 major release.

Source : Link , Question Author : nicstella , Answer Author : TrevorBliss

Leave a Comment