Set the dropdown width only when the dropdown is opened, to fix a bug where it would get set before the DOM element actually rendered. The settings field is collapsed by default (on new installations), so the computed DOM width would be invalid

This commit is contained in:
cmdr2 2023-02-28 15:37:06 +05:30
parent 0e57487774
commit 1a3086230e

View File

@ -509,8 +509,11 @@ class ModelDropdown
this.modelList.addEventListener('mousemove', this.bind(this.highlightModelAtPosition, this))
this.modelList.addEventListener('mousedown', this.bind(this.processClick, this))
let modelFilterStyle = window.getComputedStyle(this.modelFilter)
rootModelList.style.minWidth = modelFilterStyle.width
let mf = this.modelFilter
this.modelFilter.addEventListener('focus', function() {
let modelFilterStyle = window.getComputedStyle(mf)
rootModelList.style.minWidth = modelFilterStyle.width
})
this.selectEntry(this.activeModel)
}