[SalesForce] cannot get aura:id

I have the following input in my component:

<ui:inputNumber class="slds-input" aura:id="thisInput" value="{!v.thisVal}" change="{!c.inputChange}"/> 

which calls the following controller:

inputChange: function(c, e, h){
    var localId = event.getSource().getLocalId();
    var field=component.find(localId);
    ...
}

Everything was fine for months. Today I started getting the following error:

Something has gone wrong. Action failed:
c$MyComponentl$controller$inputChange[TypeError: Cannot read property
'get' of undefined] Failing descriptor:
{c$MyComponent$controller$inputChange}. Please try again. Looking at
localId, it is returning undefined.

If I switch from an inputNumber to an inputText, there is no issue:

<ui:inputNumber class="slds-input" aura:id="thisInput" value="{!v.thisVal}" change="{!c.inputChange}"/>

Error

<ui:inputText class="slds-input" aura:id="thisInput" value="{!v.thisVal}" change="{!c.inputChange}"/>

Good

Any thoughts as to why this is happening?

Best Answer

This is a combination of issues:

  • I am seeing a flurry of access control exceptions in the javascript console:

    WARNING: Access Check Failed! AttributeSet.get(): attribute 'thisVal' of component 'markup://dutchdevde:inputNumberIssue {1:2;a}' is not visible to 'markup://dutchdevde:inputNumberIssue {1:2;a}'. aura_proddebug.js:16420 WARNING: Access Check Failed! AttributeSet.get(): attribute 'thisVal' of component 'markup://dutchdevde:inputNumberIssue {1:2;a}' is not visible to 'markup://dutchdevde:inputNumberIssue {1:2;a}'.

  • a bug in ui:inputNumberLibrary.initialize() that I will notify the team that owns that functionality of.