Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Commit

Permalink
Focus modal instead of parent dialog (#1392)
Browse files Browse the repository at this point in the history
  • Loading branch information
saransh kataria authored and Blackbaud-SteveBrush committed Jan 30, 2018
1 parent f695308 commit 76c5998
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/modules/modal/modal-component-adapter.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class SkyModalComponentAdapterService {
if (inputWithAutofocus) {
inputWithAutofocus.focus();
} else {
let focusEl: HTMLElement = modalEl.nativeElement.querySelector('.sky-modal-dialog');
let focusEl: HTMLElement = modalEl.nativeElement.querySelector('.sky-modal');
focusEl.focus();

}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/modal/modal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<div
class="sky-modal-dialog"
role="dialog"
tabindex="-1"
[attr.aria-describedby]="ariaDescribedBy"
[attr.aria-labelledby]="ariaLabelledBy"
(window:resize)="windowResize()"
>
<div class="sky-modal"
tabindex="-1"
[ngClass]="{
'sky-modal-full-page': modalFullPage,
'sky-modal-small' : isSmallSize,
Expand Down
6 changes: 5 additions & 1 deletion src/modules/modal/modal.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
flex-direction: column;
}

.sky-modal:focus {
outline: none;
}

@media (min-width: $sky-screen-sm-min) {
.sky-modal:not(.sky-modal-large) {
margin: 0 auto;
Expand Down Expand Up @@ -125,4 +129,4 @@
:host /deep/ .sky-sectioned-form {
height: 460px;
margin: -$sky-margin-plus-half;
}
}
2 changes: 1 addition & 1 deletion src/modules/modal/modal.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('Modal component', () => {

it('should focus the dialog when no autofocus is inside of content', fakeAsync(() => {
let modalInstance1 = openModal(ModalTestComponent);
expect(document.activeElement).toEqual(document.querySelector('.sky-modal-dialog'));
expect(document.activeElement).toEqual(document.querySelector('.sky-modal'));
closeModal(modalInstance1);
}));

Expand Down

0 comments on commit 76c5998

Please sign in to comment.