Skip to content

Commit

Permalink
Added 'disableActiveInteraction' per step. (#534)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmsperera authored Jan 20, 2025
1 parent d921c63 commit e43c081
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/src/content/guides/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions src/driver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export type DriveStep = {
onHighlighted?: DriverHook;
onDeselected?: DriverHook;
popover?: Popover;
disableActiveInteraction?: boolean;
};

export function driver(options: Config = {}) {
Expand Down
2 changes: 1 addition & 1 deletion src/highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit e43c081

Please sign in to comment.