mirror of
https://github.com/kamranahmedse/driver.js.git
synced 2026-10-30 19:27:40 +08:00
Added 'disableActiveInteraction' per step. (#534)
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -13,6 +13,7 @@ export type DriveStep = {
|
||||
onHighlighted?: DriverHook;
|
||||
onDeselected?: DriverHook;
|
||||
popover?: Popover;
|
||||
disableActiveInteraction?: boolean;
|
||||
};
|
||||
|
||||
export function driver(options: Config = {}) {
|
||||
|
||||
+1
-1
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user