Skip to content
This repository was archived by the owner on Mar 18, 2025. It is now read-only.

Commit c908142

Browse files
committed
Prevent menu and container from being referenced if not present
1 parent 46e4ff2 commit c908142

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

resources/js/components/custom-select.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,11 @@ export default function customSelect(state) {
316316
},
317317

318318
focusFilter() {
319-
this.$nextTick(() => this.$refs.filter.focus());
319+
this.$nextTick(() => this.$refs.filter && this.$refs.filter.focus());
320320
},
321321

322322
focusMenu() {
323-
this.$nextTick(() => this.$refs.menu.focus());
323+
this.$nextTick(() => this.$refs.menu && this.$refs.menu.focus());
324324
},
325325

326326
onShiftTab() {
@@ -376,6 +376,10 @@ export default function customSelect(state) {
376376
},
377377

378378
positionMenu() {
379+
if (! this.$refs.container) {
380+
return;
381+
}
382+
379383
this.$refs.container.classList.remove('custom-menu-top');
380384

381385
// give a little bit of breathing room at the bottom of the screen.

0 commit comments

Comments
 (0)