Allow observing whether the current microfrontend has received focus or contains embedded web content that has received focus.

Hierarchy

  • FocusMonitor

Constructors

Properties

Constructors

Properties

focus$: Observable<boolean> = ...

Observable that emits when the current microfrontend has gained or lost focus.

Upon subscription, the Observable emits the current focus state, and then continuously emits when it changes. It never completes.

focusWithin$: Observable<boolean> = ...

Observable that emits when the current microfrontend or any of its child microfrontends has gained or lost focus. The Observable does not emit while the focus remains within this microfrontend or any of its child microfrontends. Upon subscription, the Observable emits the current focus-within state, and then continuously emits when it changes. It never completes.

This Observable is like the :focus-within CSS pseudo-class but operates across iframe boundaries. For example, it can be useful when implementing overlays that close upon focus loss.

Note that this Observable emits only for microfrontends that are connected to the platform as registered micro app.

See also the onfocuswithin event triggered by <sci-router-outlet> when embedded content has gained or lost focus.

Generated using TypeDoc