platform-bible-react
    Preparing search index...

    Function shouldSuppressFocusReturn

    • Experimental

      Decides whether closing a menu or popover must not return focus to its trigger.

      Returning focus across frames closes the menu the user just opened elsewhere, so focus stays where the user put it when that is a web view (activeElement is an <iframe>) or, inside a web view, when the window no longer has focus. In the main document !hasFocus() can only mean the OS window was deactivated (a click into a web view leaves the document focused with the iframe as active element), so restoring the trigger there is safe and helps keyboard users returning from another application. Inside a web view it is ambiguous (switching applications versus clicking into another frame) and stays suppressed.

      It decides only whether to suppress; useDismissOnWindowBlur restores the trigger itself in the main-document case.

      Parameters

      • doc: Document

        The document the surface renders in

      • isInWebView: boolean

        Whether that document's window is a web view; see isRunningInWebView

      Returns boolean

      true when focus must not be returned to the trigger This export is unstable and may change shape or disappear without notice