Class FullscreenSession

java.lang.Object
com.vaadin.flow.component.page.FullscreenSession
All Implemented Interfaces:
Serializable

public class FullscreenSession extends Object implements Serializable
A handle to a single fullscreen request, returned by Page.requestFullscreen() and Component.requestFullscreen().

A session is the unit that ties together one lifecycle (PENDING → ACTIVE or REJECTED → an EXITED state), the owner component that asked for fullscreen (empty when the whole page was requested), and how it ended. Subscribe to stateSignal() to react to lifecycle transitions; call exit() to end the session from server code. The page-level Page.fullscreenSignal() answers the cross-session "is anything fullscreen right now" question and is independent of sessions.

Only one session can be active per page at a time. Starting a new request while one is active transitions the old session to EXITED_BY_CODE before the new session is returned.

If a request is rejected (no user activation, permissions policy, etc.) or exits, the error() accessor returns the browser-provided error message when available, otherwise empty.

See Also:
  • Method Details

    • stateSignal

      public Signal<FullscreenSessionState> stateSignal()
      Returns a read-only signal that tracks this session's lifecycle state.

      The signal starts at FullscreenSessionState.PENDING and transitions through FullscreenSessionState.ACTIVE on a successful request, or directly to a terminal state on rejection or exit. Once in a terminal state the signal does not change again. Subscribe with Signal.effect(owner, ...) to react to transitions.

      Returns:
      the read-only session state signal
    • owner

      public Optional<Component> owner()
      Returns the component that requested fullscreen, or empty if the entire page was requested via Page.requestFullscreen(). Useful for binding the active component's appearance (e.g. an expanded style class) only on the owner.
      Returns:
      the owner component, or empty for a page-level session
    • error

      public Optional<String> error()
      Returns the browser-provided error message when this session is in REJECTED, or empty otherwise. Used for logging and surfacing diagnostics — the contents are browser-defined and not stable enough to drive logic.
      Returns:
      the error message, when available
    • exit

      public void exit()
      Ends this session. Equivalent to Page.exitFullscreen() when this session is active; a no-op if the session already ended.