Skip to content

Commit

Permalink
Move Tippy hooks to separate arrow function declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
laymonage committed Jan 26, 2024
1 parent ea28844 commit 6991c1f
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions client/src/controllers/DropdownController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,21 @@ export class DropdownController extends Controller<HTMLElement> {
});
}

const onShow = () => {
if (hoverTooltipInstance) {
hoverTooltipInstance.disable();
}
};

const onShown = () => {
this.dispatch('shown');
};

const onHide = () => {
this.dispatch('hide');
if (hoverTooltipInstance) {
hoverTooltipInstance.enable();
}
};

return {
Expand All @@ -162,20 +171,9 @@ export class DropdownController extends Controller<HTMLElement> {
...(this.hasOffsetValue && { offset: this.offsetValue }),
getReferenceClientRect: () => this.reference.getBoundingClientRect(),
theme: this.themeValue,
onShow() {
if (hoverTooltipInstance) {
hoverTooltipInstance.disable();
}
},
onShown() {
onShown();
},
onHide() {
if (hoverTooltipInstance) {
hoverTooltipInstance.enable();
}
onHide();
},
onShow,
onShown,
onHide,
};
}

Expand Down

0 comments on commit 6991c1f

Please sign in to comment.