I have a button alongside lightning:input with type="date". When I click on the button I want to focus on the input and show calendar to pick a date but it focuses only and calendar is visible only after I click on the input. How to fire showing of the calendar after button click?

<lightning:button onclick="{!c.setFocus}"/>
<lightning:input type="date" aura:id="dateInput"/>

setFocus : function(component) {

  • Unfortunately this looks like it might not be possible. Reading the comments on this closed issue, it isn't something that will be supported: github.com/salesforce/lwc/issues/1519 Apr 17, 2023 at 4:43
  • @CallumMacErlich I guess it should be possible because when we click by mouse it fires some event, so I guess there is some event we can fire programmatically Apr 17, 2023 at 9:11


You must log in to answer this question.

Browse other questions tagged .