Skip to content

Commit 5e94a1b

Browse files
committed
Update tooltip to close on tab
1 parent 574a09e commit 5e94a1b

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/dialog/dialog.directive.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ export class DialogDirective implements OnInit, OnDestroy, OnChanges {
122122
if (event.key === "Escape") {
123123
this.close();
124124
}
125+
if (event.target === this.dialogConfig.parentRef.nativeElement && (event.key === "Tab" || event.key === "Tab" && event.shiftKey)) {
126+
this.close();
127+
}
125128
}
126129

127130
ngOnChanges() {

src/dialog/dialog.service.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class DialogService {
143143
* @param {any} [evt]
144144
* @memberof DialogService
145145
*/
146-
close(viewContainer: ViewContainerRef, focusPreviouslyFocusedElement = true) {
146+
close(viewContainer: ViewContainerRef) {
147147
this.isClosed.emit(true);
148148

149149
if (this.dialogRef) {
@@ -155,9 +155,7 @@ export class DialogService {
155155
}
156156
this.dialogRef = null;
157157
this.isOpen = false;
158-
if (focusPreviouslyFocusedElement) {
159158
elementToFocus.focus();
160-
}
161159

162160
if (this.dialogSubscription) {
163161
this.dialogSubscription.unsubscribe();

src/dialog/tooltip/tooltip.directive.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,4 @@ export class TooltipDirective extends DialogDirective {
8181
this.dialogConfig.content = this.ibmTooltip;
8282
this.dialogConfig.type = this.tooltipType;
8383
}
84-
85-
close() {
86-
this.dialogService.close(this.viewContainerRef, false);
87-
this.expanded = false;
88-
}
8984
}

0 commit comments

Comments
 (0)