I have a custom popup component for displaying help text near form fields.
I wanted to make it more dynamic - make the position of the nubin a component attribute. And Now I'm facing a strange behaviour I don't understand. This is the original code:
<button class="slds-button slds-button_icon" onclick="{!c.handleToggle}" />
<section aura:id="helpPopup" class="slds-popover slds-nubbin_left-top slds-hide" >
...
</section>
and the controller's code to toggle visibility of popup on button click
handleToggle:function(component, event, helper) {
var help = component.find("helpPopup");
$A.util.toggleClass(help, 'slds-hide');
},
the code above works well, this code also works well (class replaced with expression)
<section aura:id="helpPopup" class="{! 'slds-popover slds-nubbin_left-top slds-hide'}" />
But this prevents popup from showing up although the html code looks identical
<aura:attribute name="nubinSldsClass" type="String" default=" slds-nubbin_left-top" /> <!-- -->
<section aura:id="helpPopup" class="{! 'slds-popover '+v.nubinSldsClass+' slds-hide '}" />
var oldClass = element.$getShadowAttribute$(attribute);
returning an empty string for the attribute "v.HTMLAttributes.class" which then stopped the method doing anything because of a lateroldClass !== constructedClass
check: no "slds-hide' required and none present so do nothing. So at first sight it looks like a bug...