Optional
cleanReadonly
closedReadonly
closeReadonly
contentContent element target, to be shown/hidden with classes when opened/closed.
Readonly
contextReadonly
hasReadonly
hasReadonly
openedReadonly
openedReadonly
openReadonly
peekGlobal selector string to be used to determine the container to add the mouseleave listener to.
Readonly
storageLocal storage key to be used to backup the open state of this controller, this can be unique or shared across multiple controllers, it uses the controller identifier for the base.If not provided, the controller will not attempt to store the state to local storage.
Readonly
toggleToggle button element(s) to have their classes and aria attributes updated.
Static
blessingsStatic
classesStatic
outletsStatic
targetsStatic
valuesPrepare a unique local storage key for this controller joined with the store value, if not provided then assume we do not want to store the state of this controller.
Get the stored (closed) state of this controller from local storage. If the key is not available, return undefined.
Set the stored state of this controller in the local storage. If the store key value is not set, do nothing.
Collects all toggles, those controlled by this controller and any external that have an aria-controls references to any content target elements.
Static
shouldClose (hide) the reveal content.
Handles changes to the closed state,updating element classes and aria-expanded
attributes accordingly.
Note: This may not trigger when clicking the toggle button if the element is already open in peeking mode.
Optional
previouslyClosed: booleanConnect the controller, setting up the peeking listener if required, and setting the initial state based on the stored value if available.
Finally, dispatch the ready event to signal the controller is ready.
Open (show) the reveal content.
Toggle the open/closed state of the controller, accounting for the peeking state (visually open, but not 'fixed' as open). The updated closed value will be stored in local storage if available.
Set the inner icon on any toggles (in scope or out of scope).
Static
after
Adds the ability to make the controlled element be used as an opening/closing (aka collapsing) element. Supports, and relies on, correct usage of aria-* attributes.
See
https://w3c.github.io/aria/#aria-expanded
Example: - Basic usage
Example: - Saving to local storage