HTML element that wraps the Exit This Page button
Optionalconfig: ExitThisPageConfig = {}Exit This Page config
Protected_Private$buttonPrivate$indicatorPrivate$overlayPrivate$skiplinkPrivate$updatePrivatei18nPrivatekeypressPrivatekeypressPrivatelastPrivatetimeoutPrivatetimeoutStatic ConstantdefaultsExit this page default config
StaticelementStaticmoduleName for the component used when initialising using data-module attributes.
Static ConstantschemaExit this page config schema
Protected$rootProtectedReturns the root element of the component
ProtectedconfigProtectedReturns the root element of the component
Internal VirtualconfigOverride
Function which defines configuration overrides to prioritize properties from the root element's dataset.
It should take a subset of configuration as input and return a new configuration object with properties that should be overridden based on the root element's dataset. A Symbol is used for indexing to prevent conflicts.
Optionalparam: Partial<ExitThisPageConfig>Configuration object
return - Configuration object
PrivatebuildPrivateCreate the HTML for the 'three lights' indicator on the button.
PrivateexitPrivateInitiates the redirection away from the current page. Includes the loading overlay functionality, which covers the current page with a white overlay so that the contents are not visible during the loading process. This is particularly important on slow network connections.
PrivatehandlePrivatePre-activation logic for when the button is clicked/activated via mouse or pointer.
We do this to differentiate it from the keyboard activation event because we
need to run e.preventDefault as the button or skiplink are both links and we
want to apply some additional logic in exitPage before navigating.
mouse click event
PrivatehandlePrivateLogic for the 'quick escape' keyboard sequence functionality (pressing the Shift key three times without interruption, within a time limit).
keyup event
PrivateinitPrivateCreate button click handlers.
PrivateinitPrivateCreate the we use for screen reader announcements.
PrivateresetPrivateStops and resets the 'quick escape' keyboard sequence timer.
PrivateresetPrivateReset the page using the EtP button
We use this in situations where a user may re-enter a page using the browser back button. In these cases, the browser can choose to restore the state of the page as it was previously, including restoring the 'ghost page' overlay, the announcement span having it's role set to "alert" and the keypress indicator still active, leaving the page in an unusable state.
By running this check when the page is shown, we can programatically restore the page and the component to a "default" state
PrivatesetPrivateStarts the 'quick escape' keyboard sequence timer.
This can be invoked several times. We want this to be possible so that the timer is restarted each time the shortcut key is pressed (e.g. the user has up to n seconds between each keypress, rather than n seconds to invoke the entire sequence.)
PrivateupdatePrivateUpdate whether the lights are visible and which ones are lit up depending on
the value of keypressCounter.
Staticcheck
Exit this page component