Is there a way to know if an overlay is active? #6006
Replies: 2 comments
-
@warpdesign are you looking for an imperative API to tell if any Blueprint overlay is open in the document (dialog, popover, tooltip, drawer, context menu, etc...)? Something like the following? import { Overlay } from "@blueprintjs/core";
Overlay.isAnyOverlayOpen(); Technically this might be possible, since we do keep track of the overlay stack in this component: But it may be error prone in the rare case when there are multiple copies of @blueprintjs/core on the page (which is not encouraged anyway). What are you hoping to do with this information, anyway? |
Beta Was this translation helpful? Give feedback.
-
I am working on a file manager app using Electron and need to disable some native menus when an overlay is opened. Since I need to be notified when an overlay is opened/closed, such an API wouldn't be enough. I decided to add an observer using the MutationObserver API: that does the trick. |
Beta Was this translation helpful? Give feedback.
-
I know I could check that body has the
bp4-overlay-open
but is there another way that doesn't involve poking DOM elements?Beta Was this translation helpful? Give feedback.
All reactions