Skip to content

Commit

Permalink
New Ionic "trapFocus" config.
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimio committed Jul 25, 2024
1 parent 1abd03b commit c45853c
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Demo and documentation can be found at [hakimio.github.io/ngx-ui-tour](https://h

| Angular | RxJS | Ionic | ngx-ui-tour |
|---------|------|-------|-------------|
| 18 | 7 | 8 | 5 |
| 18 | 7 | 7, 8 | 4 |
| 17 | 7 | 7, 8 | 3 |
| 16 | 7 | 6, 7 | 2 |
Expand Down
1 change: 1 addition & 0 deletions projects/ngx-ui-tour-ionic/src/lib/ion-tour.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class IonTourService<T extends IonStepOption = IonStepOption> extends Tou
stepDefaults.backdropConfig ??= userDefaults?.backdropConfig ?? {};
stepDefaults.backdropConfig.parentContainer ??= userDefaults?.backdropConfig?.parentContainer ?? 'ion-app';
stepDefaults.delayAfterNavigation ??= userDefaults?.delayAfterNavigation ?? (isIOS ? 700: 500);
stepDefaults.trapFocus ??= userDefaults?.trapFocus ?? false;

super.initialize(steps, stepDefaults);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {IStepOption} from 'ngx-ui-tour-core';
export interface IonStepOption extends IStepOption {
placement?: IonPopoverPlacement;
showArrow?: boolean;
trapFocus?: boolean;
}

export interface IonPopoverPlacement {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[style.--max-width]="step?.stepDimensions?.maxWidth"
[style.--width]="step?.stepDimensions?.width"
[arrow]="step?.showArrow ?? true"
[focusTrap]="step?.trapFocus ?? false"
>
<ng-template>
<ng-container
Expand Down
1 change: 1 addition & 0 deletions src/app/ion-popover/ion-popover.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
<ng-template pageTab>
<app-step-config
[isIonicShowArrowVisible]="true"
[isIonicTrapFocusVisible]="true"
>
<app-placement-config
type="IonPopoverPlacement"
Expand Down
10 changes: 10 additions & 0 deletions src/app/shared/step-config/step-config.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@
apply in <code>md</code> mode.
</ng-template>
}
@if (isIonicTrapFocusVisible) {
<ng-template
documentationPropertyName="trapFocus"
documentationPropertyType="boolean"
[documentationPropertyValue]="false"
>
If enabled, focus will not be allowed to move outside of the tour step popover. Disabled by default to
allow focus to move outside of the popover overlay.
</ng-template>
}
@if (isMdMenuShowArrowVisible) {
<ng-template
documentationPropertyName="showArrow"
Expand Down
3 changes: 3 additions & 0 deletions src/app/shared/step-config/step-config.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ export class StepConfigComponent {
@Input()
isIonicShowArrowVisible = false;

@Input()
isIonicTrapFocusVisible = false;

@Input()
isMdMenuShowArrowVisible = false;

Expand Down

0 comments on commit c45853c

Please sign in to comment.