Creates a new DisplayService instance.
The application context
The plot element to manage
The text service for generating ARIA labels
Cleans up resources and restores initial ARIA labels.
Gets the instruction text for the plot.
OptionalincludeClickPrompt: boolean = trueWhether to include the click prompt
The instruction text
Enters label scope (TRACE_LABEL or FIGURE_LABEL) while preserving the current scope on the stack. This allows proper restoration when exiting label scope.
Note: Label scopes are not pushed to focusStack (which only holds Focus types). The previous scope is preserved in focusStack and used when exiting.
The label scope to enter (TRACE_LABEL or FIGURE_LABEL)
Exits label scope and returns to the previous scope that was active before entering label mode.
Uses the focusStack to determine the correct scope to return to, which preserves the scope that was active before entering label mode (e.g., TRACE, BRAILLE, etc.).
Syncs the focusStack to match the current scope without triggering a full focus change event. Use this when the scope has changed via Context (e.g., entering a subplot) but focusStack needs to stay in sync.
The scope to set as the current focus
Toggles focus between different scopes and manages the focus stack.
The focus scope to toggle to
Resets the focus stack to the given scope and moves focus to the plot element. Does not fire a display change event — the caller must call notifyFocusChange after completing any follow-up scope transitions (e.g. exitSubplot) to avoid emitting a stale intermediate scope.
The scope the focus stack should reflect after the modal is dismissed. The stack is reset to this value so it stays in sync with the hotkeys scope set by the caller.
Important: The caller must ensure the hotkeys scope is set to
targetScope (e.g. via context.exitSubplot()) before or immediately
after this call. This method only updates the focus stack and DOM focus;
it does not change the hotkeys scope.
Fires a deferred display change event with the given scope. The deferral (setTimeout 0) gives screen readers one event-loop cycle to process the preceding focus change before React unmounts the modal element (e.g. the braille textarea). Without this, NVDA/JAWS exit focus mode when the focused element disappears from the DOM.
Cancels any previously pending notification to avoid stale events from rapid repeated calls.
The scope to emit as the new display focus
Service for managing display focus, ARIA labels, and UI state transitions.