When I set a link to draggable = false in aura component (using lightning-out), the attribute is somehow being reset to draggable = true during compilation. The link is draggable.

Why is the attribute being set to true and how can I make an undraggable link in aura components.

Component code:

  <a draggable="false" href="https://www.google.com">my link</a>

Aura app:

<aura:application extends="ltng:outApp">
    <aura:dependency resource="test"/>

VF page:

 <apex:page cache="false" sidebar="false">
 <apex:includeLightning />
 <div id="test-area">


    $Lightning.use("c:testApp", function(){



No idea why this is happening, but the work around I'm currently using is to set the anchor elements to draggable=false using javascript with a render handler.

in cmp:

 <aura:handler name="render" value="{!this}" action="{! c.onRender }" />

in controller:

onRender : function(component, event, helper) {
   var anchorList =  document.getElementsByTagName('a');
   for(var i = 0; i < anchorList.length; i ++){
      anchorList[i].setAttribute("draggable", "false");

Seems to work, but feels like there should be a better way of doing this!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.