Mahesh Perera
commited on
Added 'disableActiveInteraction' per step. (#534)
Browse files- docs/src/content/guides/configuration.mdx +4 -0
- src/driver.ts +1 -0
- src/highlight.ts +1 -1
docs/src/content/guides/configuration.mdx
CHANGED
|
@@ -42,6 +42,7 @@ type Config = {
|
|
| 42 |
allowKeyboardControl?: boolean;
|
| 43 |
|
| 44 |
// Whether to disable interaction with the highlighted element. (default: false)
|
|
|
|
| 45 |
disableActiveInteraction?: boolean;
|
| 46 |
|
| 47 |
// If you want to add custom class to the popover
|
|
@@ -197,6 +198,9 @@ type DriveStep = {
|
|
| 197 |
// Look at the Popover Configuration section
|
| 198 |
popover?: Popover;
|
| 199 |
|
|
|
|
|
|
|
|
|
|
| 200 |
// Callback when the current step is deselected,
|
| 201 |
// about to be highlighted or highlighted.
|
| 202 |
// Each callback receives the following parameters:
|
|
|
|
| 42 |
allowKeyboardControl?: boolean;
|
| 43 |
|
| 44 |
// Whether to disable interaction with the highlighted element. (default: false)
|
| 45 |
+
// Can be configured at the step level as well
|
| 46 |
disableActiveInteraction?: boolean;
|
| 47 |
|
| 48 |
// If you want to add custom class to the popover
|
|
|
|
| 198 |
// Look at the Popover Configuration section
|
| 199 |
popover?: Popover;
|
| 200 |
|
| 201 |
+
// Whether to disable interaction with the highlighted element. (default: false)
|
| 202 |
+
disableActiveInteraction?: boolean;
|
| 203 |
+
|
| 204 |
// Callback when the current step is deselected,
|
| 205 |
// about to be highlighted or highlighted.
|
| 206 |
// Each callback receives the following parameters:
|
src/driver.ts
CHANGED
|
@@ -13,6 +13,7 @@ export type DriveStep = {
|
|
| 13 |
onHighlighted?: DriverHook;
|
| 14 |
onDeselected?: DriverHook;
|
| 15 |
popover?: Popover;
|
|
|
|
| 16 |
};
|
| 17 |
|
| 18 |
export function driver(options: Config = {}) {
|
|
|
|
| 13 |
onHighlighted?: DriverHook;
|
| 14 |
onDeselected?: DriverHook;
|
| 15 |
popover?: Popover;
|
| 16 |
+
disableActiveInteraction?: boolean;
|
| 17 |
};
|
| 18 |
|
| 19 |
export function driver(options: Config = {}) {
|
src/highlight.ts
CHANGED
|
@@ -157,7 +157,7 @@ function transferHighlight(toElement: Element, toStep: DriveStep) {
|
|
| 157 |
fromElement.removeAttribute("aria-expanded");
|
| 158 |
fromElement.removeAttribute("aria-controls");
|
| 159 |
|
| 160 |
-
const disableActiveInteraction = getConfig("disableActiveInteraction");
|
| 161 |
if (disableActiveInteraction) {
|
| 162 |
toElement.classList.add("driver-no-interaction");
|
| 163 |
}
|
|
|
|
| 157 |
fromElement.removeAttribute("aria-expanded");
|
| 158 |
fromElement.removeAttribute("aria-controls");
|
| 159 |
|
| 160 |
+
const disableActiveInteraction = toStep.disableActiveInteraction ?? getConfig("disableActiveInteraction");
|
| 161 |
if (disableActiveInteraction) {
|
| 162 |
toElement.classList.add("driver-no-interaction");
|
| 163 |
}
|