Skip to content

Commit 278f8d5

Browse files
committed
Fix active element on mouseover on fetched options
1 parent b01ec3f commit 278f8d5

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

public/vendor/bs-blade-forms/assets/main-3a8b4db0.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/vendor/bs-blade-forms/assets/main-b4401358.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/vendor/bs-blade-forms/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"src": "resources/css/main.scss"
66
},
77
"resources/js/main.ts": {
8-
"file": "assets/main-3a8b4db0.js",
8+
"file": "assets/main-b4401358.js",
99
"isEntry": true,
1010
"src": "resources/js/main.ts"
1111
}

resources/js/components/custom-select.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,6 @@ export class CustomSelect {
7878
init = () => {
7979
this.populateDropdown()
8080

81-
for (const [key, opt] of this.dropdownOptions) {
82-
opt.addEventListener(
83-
'mousemove',
84-
throttle((e) => (key !== this.active ? this.setActive(key) : null), 25),
85-
)
86-
}
87-
8881
this.uiBox.addEventListener('click', () => this.toggle())
8982

9083
document.addEventListener('click', (e) => {
@@ -390,6 +383,8 @@ export class CustomSelect {
390383

391384
optionsWrapper.appendChild(dropdownOption)
392385

386+
this.onDropdownOptionCreated(dropdownOption, optEl.value)
387+
393388
this.dropdownOptions.set(optEl.value, dropdownOption)
394389
this.optionsSearchText.set(optEl.value, optEl.label.toLowerCase())
395390
}
@@ -403,6 +398,13 @@ export class CustomSelect {
403398
})
404399
}
405400

401+
onDropdownOptionCreated = (opt: HTMLElement, key: string) => {
402+
opt.addEventListener(
403+
'mousemove',
404+
throttle((e) => (key !== this.active ? this.setActive(key) : null), 25),
405+
)
406+
}
407+
406408
onOptionSelected = (key: string | null) => {
407409
if (key == null) {
408410
key = this.emptyValue

0 commit comments

Comments
 (0)