function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
smita bhargavasmita bhargava 

scroll to component in lighning

I have a code in my lightning component as follows.
Comp1.cmp

 <aura:attribute name="showProviderListcmp" type="Boolean" default="false"/>

  <lightning:card>
                <lightning:layout>
                    <lightning:layoutItem flexibility="auto" padding="around-small">
                  
                     <div onkeyup="{!c.handleKeyUp}">
                            <lightning:input
                                             aura:id="enter-search"
                                             name="searchProvider"
label=""
placeholder = "Search by Name, Speciality, Procedure, Condition or Provider ID  "
type="search"
                                             />
                        </div>
                      
                    </lightning:layoutItem>
                </lightning:layout>
            </lightning:card>      

<aura:if isTrue="{!v.showSpinner}">
       
        <lightning:spinner aura:id="spinner" variant="brand" size="medium" alternativeText="service Request"/> 
        <aura:set attribute="else">
            <aura:if isTrue="{!v.showProviderListcmp}">
             
                <div class="slds-p-bottom_xx-small" id="scrollDiv"></div>
                <lightning:card title="" aura:id="displayFindCareList">
                    <c:COMP2/>
                </lightning:card>
             
            </aura:if>
        </aura:set>
    </aura:if> 

Comp1Controller.js

 handleKeyUp : function (component,event,helper) {
      
   
        var isEnterKey = event.keyCode === 13;
        if (isEnterKey) {
            var queryTerm = component.find('enter-search').get('v.value');
            if (queryTerm.length > 2) {
          
                helper.navigateToList(component,event,helper,queryTerm);
        
            }}
   
    },

Comp1Helper.js

   navigateToList :  function(component,event,helper,queryTerm){
         var flow = component.find("autoServiceRequest");
        component.set("v.showSpinner",true);   
        var inputVariables =[
            {name: "varCaseRecordId",type:"String",value : component.get("v.caseId")},
            {name: "varAutoSrReason",type:"String",value : "Find Provider"},
            {name:"varAutoSrSubReason" ,type:"String",value:queryTerm}
        ];
        
       flow.startFlow("GPS_Create_Auto_Service_Request",inputVariables); 
 
        component.set("v.showProviderListcmp",true);
       
    },

what I want is when I type some test and click enter key in lightning:input, inside the method "handleKeyUp" I want to navigate to CompB i.e I want to scrollDown to CompB without the user manually having to do so.

I am struggling with his, please let me know with working code.

thanks
smita B