From bf8d3f6289c76bc708e5b487231939d02bfab3c4 Mon Sep 17 00:00:00 2001 From: Material Web Team Date: Tue, 14 Nov 2023 16:12:23 -0800 Subject: [PATCH] fix(menu): declare popover API types Without it show/hide popover get renamed by closure. PiperOrigin-RevId: 582471354 --- .../controllers/surfacePositionController.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/menu/internal/controllers/surfacePositionController.ts b/menu/internal/controllers/surfacePositionController.ts index cc9e184f38..584b4b64cf 100644 --- a/menu/internal/controllers/surfacePositionController.ts +++ b/menu/internal/controllers/surfacePositionController.ts @@ -7,6 +7,20 @@ import {ReactiveController, ReactiveControllerHost} from 'lit'; import {StyleInfo} from 'lit/directives/style-map.js'; +/** + * Declare popoverAPI functions. See + * https://developer.mozilla.org/en-US/docs/Web/API/Popover_API + * Without this, closure will rename these functions. Can remove once these + * functions make it into the typescript lib. + */ +declare global { + interface HTMLElement { + showPopover(): void; + hidePopover(): void; + togglePopover(force: boolean): void; + } +} + /** * An enum of supported Menu corners */