Class PopoverTriggerContext
What a custom trigger for a TwPopover needs: the attributes that tie it to the panel for assistive technology, and a way to open and close the panel.
[ExcludeFromCodeCoverage]
public sealed class PopoverTriggerContext
- Inheritance
-
PopoverTriggerContext
- Inherited Members
Remarks
Splat Attributes onto the element that opens the popover, which should be a button, and call ToggleAsync from its click handler.
Constructors
PopoverTriggerContext(IReadOnlyDictionary<string, object>, bool, Func<Task>)
Initializes a new instance of the PopoverTriggerContext class.
public PopoverTriggerContext(IReadOnlyDictionary<string, object> attributes, bool isOpen, Func<Task> toggleAsync)
Parameters
attributesIReadOnlyDictionary<string, object>The trigger's id and ARIA attributes.
isOpenboolWhether the panel is open.
toggleAsyncFunc<Task>Opens the panel when it is closed, and closes it when it is open.
Properties
Attributes
Gets the trigger's id and the aria-haspopup, aria-expanded and aria-controls attributes
that tie it to the panel.
public IReadOnlyDictionary<string, object> Attributes { get; }
Property Value
IsOpen
Gets whether the panel is open.
public bool IsOpen { get; }
Property Value
ToggleAsync
Gets the function that opens the panel when it is closed, and closes it when it is open.
public Func<Task> ToggleAsync { get; }