MCPcopy Create free account
hub / github.com/dailydotdev/apps / closeTopLayer

Function closeTopLayer

packages/shared/src/hooks/useNativeBridge.ts:27–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25// What a back press closes before history moves: the reading drawer, then
26// the top-most sheet, menu or dialog.
27export const closeTopLayer = (): boolean => {
28 if (requestReadingClose()) {
29 return true;
30 }
31
32 if (!hasOpenLayer()) {
33 return false;
34 }
35
36 (document.activeElement ?? document.body).dispatchEvent(
37 new KeyboardEvent('keydown', {
38 key: 'Escape',
39 bubbles: true,
40 cancelable: true,
41 }),
42 );
43 return true;
44};
45
46// The web side of the wrappers' contract: what they call on the page
47// (refresh, back), and what the page tells them (where it is, and a light

Callers 1

Calls 2

requestReadingCloseFunction · 0.90
hasOpenLayerFunction · 0.90

Tested by

no test coverage detected