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
Vishwas B NVishwas B N 

lightning-combobox onblur and onfocus not properly working

Hi Team,

I have a lightning-combobox element in my modal view. I need to make modal body little larger on clicking the lightning-combobox element and to original size when out of focus.

But i am not getting the expected behaviour. On focus of  lightning-combobox, the modal body is becoming larger but not listing the option. 

Below are my code for better under standing.

file.html

<div class="slds-col slds-size_1-of-2">
              <lightning-combobox  required class="newrecordvalidation" label="Department"  name="department_id"  value={newqcchecklist.department_id}  placeholder="Departments" options={departmentlistoptions}  onchange={tracknewvaluechange} onfocus={addmodalclass} onblur={removemodalclass}></lightning-combobox>
            </div>


file.css

.modalBody {
    height: 220px;
}



file.js

addmodalclass(){
        this.template.querySelector('[data-id="modal-content-id-2"]').classList.add('modalBody');
      }

      removemodalclass(){
        this.template.querySelector('[data-id="modal-content-id-2"]').classList.remove('modalBody');        
      }​​​​​​​


Video Clip : https://vimeo.com/571163587

Can you please help
mukesh guptamukesh gupta
Hi Vishwas,

Can you please  add alert  in both function, and after please let me know
Vishwas B NVishwas B N
Hi Mukesh,

Thank you for your response.
I did add the alert in to onblur and onfocus function. And it is running in loop.
 
So i just tried adding console.log() in both functions. 

On focusing the combobox the focus, console log is printing every time. Issue is with showing the option. How can i able to make it load option after calling onfocus function ?(ideally it should show options right ?)

Can you tell me, am i doing something wrong in code, which stop loading option on becoming focused?

Thank you in advance.