Skip to content

Commit

Permalink
Merge pull request #383 from StrahilKazlachev/fix/api/add-missing-types
Browse files Browse the repository at this point in the history
fix(settings): add missing types
  • Loading branch information
EisenbergEffect authored Sep 14, 2019
2 parents 55061cb + 0a518f1 commit 2d8a41f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/aurelia-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export * from './dialog-settings';
export * from './dialog-configuration';
export * from './renderer';
export * from './dialog-cancel-error';
export * from './dialog-close-error';
export * from './dialog-result';
export * from './dialog-service';
export * from './dialog-controller';
9 changes: 9 additions & 0 deletions src/dialog-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ export interface DialogSettings {
* When invoked the function is passed the dialog container and the dialog overlay elements.
*/
position?: (dialogContainer: Element, dialogOverlay?: Element) => void;

/**
* This function is called when a dialog closes to restore focus to the last
* element that was focused when the dialog opened. It can be overridden in
* general settings, or on a case by case basis by providing an override when
* a particular dialog is opened.
*/
restoreFocus?: (lastActiveElement: HTMLElement) => void;
}

/**
Expand All @@ -105,4 +113,5 @@ export class DefaultDialogSettings implements DialogSettings {
public rejectOnCancel = false;
public ignoreTransitions = false;
public position?: (dialogContainer: Element, dialogOverlay: Element) => void;
public restoreFocus = (lastActiveElement: HTMLElement) => lastActiveElement.focus();
}

0 comments on commit 2d8a41f

Please sign in to comment.