Added 'disableActiveInteraction' per step. (#534)

This commit is contained in:
Mahesh Perera
2025-01-20 00:25:17 +00:00
committed by GitHub
parent d921c63893
commit e43c08142a
3 changed files with 6 additions and 1 deletions
@@ -42,6 +42,7 @@ type Config = {
allowKeyboardControl?: boolean;
// Whether to disable interaction with the highlighted element. (default: false)
// Can be configured at the step level as well
disableActiveInteraction?: boolean;
// If you want to add custom class to the popover
@@ -197,6 +198,9 @@ type DriveStep = {
// Look at the Popover Configuration section
popover?: Popover;
// Whether to disable interaction with the highlighted element. (default: false)
disableActiveInteraction?: boolean;
// Callback when the current step is deselected,
// about to be highlighted or highlighted.
// Each callback receives the following parameters:
+1
View File
@@ -13,6 +13,7 @@ export type DriveStep = {
onHighlighted?: DriverHook;
onDeselected?: DriverHook;
popover?: Popover;
disableActiveInteraction?: boolean;
};
export function driver(options: Config = {}) {
+1 -1
View File
@@ -157,7 +157,7 @@ function transferHighlight(toElement: Element, toStep: DriveStep) {
fromElement.removeAttribute("aria-expanded");
fromElement.removeAttribute("aria-controls");
const disableActiveInteraction = getConfig("disableActiveInteraction");
const disableActiveInteraction = toStep.disableActiveInteraction ?? getConfig("disableActiveInteraction");
if (disableActiveInteraction) {
toElement.classList.add("driver-no-interaction");
}