I am using lightning-record-edit-form to display to users custom Opportunity form with the help of lightning-input-field. However, I am unable to set focus on a particular field.
I have a in a modal window, and I want to focus on this field when the modal opens so that the user doesn't have to use their mouse or tab to set focus.
However, when I try to set focus on Amount field using the below code, it didn't work.
let fieldToFocus = this.template.querySelector("lightning-input-field[data-fieldname='Amount']");
if(fieldToFocus){
fieldToFocus.focus();
}
Has anybody been able to make focus work with lightning-input-field?