From 6991c1f2d9a44d91beb29462efdeacdbed7ec0ac Mon Sep 17 00:00:00 2001 From: Sage Abdullah Date: Thu, 25 Jan 2024 10:11:07 +0000 Subject: [PATCH] Move Tippy hooks to separate arrow function declarations --- client/src/controllers/DropdownController.ts | 26 +++++++++----------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/client/src/controllers/DropdownController.ts b/client/src/controllers/DropdownController.ts index 5124c7e6978c..e1533bfb9869 100644 --- a/client/src/controllers/DropdownController.ts +++ b/client/src/controllers/DropdownController.ts @@ -144,12 +144,21 @@ export class DropdownController extends Controller { }); } + const onShow = () => { + if (hoverTooltipInstance) { + hoverTooltipInstance.disable(); + } + }; + const onShown = () => { this.dispatch('shown'); }; const onHide = () => { this.dispatch('hide'); + if (hoverTooltipInstance) { + hoverTooltipInstance.enable(); + } }; return { @@ -162,20 +171,9 @@ export class DropdownController extends Controller { ...(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, }; }