0

I am trying to set focus to an input field after it is rendered, the input field is focused initially but after the whole component is loaded the focus goes away.

renderedCallback() {

    console.log('Focusing root')
    const inputBox = this.template.querySelector('lightning-input');
    inputBox.focus();
    
}
1
  • 1
    may need to add focus after a small timeout of few milliseconds – Raul May 3 at 7:38

Your Answer

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

Browse other questions tagged or ask your own question.