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

added ariaRole input to modals. made confirm modal alertdialog. Added aria-modal=true to modals #1784

Merged
merged 22 commits into from
Jul 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b4b1b05
added ariaRole input to modals. made confirm modal alertdialog
blackbaud-conorwright Jun 29, 2018
67fdd79
added aria-modal=true to modals
blackbaud-conorwright Jun 29, 2018
60652be
changed error component modals to be alertdialog roles
blackbaud-conorwright Jul 3, 2018
540340a
Merge remote-tracking branch 'upstream/master' into fix-confirm-modal…
blackbaud-conorwright Jul 3, 2018
628f73e
Merge branch 'master' into fix-confirm-modal-role-wrong
blackbaud-conorwright Jul 11, 2018
0d1ad5f
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 16, 2018
73de0ef
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 16, 2018
ac9b50a
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 16, 2018
d64c1b1
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 17, 2018
a3eb782
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 17, 2018
c6ec0d1
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 17, 2018
2254272
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 17, 2018
66a5019
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 17, 2018
0de0d80
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 18, 2018
3d1bd00
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 18, 2018
a0a9e4b
Merge remote-tracking branch 'upstream/master' into fix-confirm-modal…
blackbaud-conorwright Jul 18, 2018
9cd8c69
fixed mixed up unit test and added ariaRole coverage
blackbaud-conorwright Jul 18, 2018
a15c93f
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 18, 2018
2d3218b
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 18, 2018
f59c5f6
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 30, 2018
b03bf7c
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 30, 2018
b301849
Merge branch 'master' into fix-confirm-modal-role-wrong
Blackbaud-SteveBrush Jul 30, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/modules/confirm/confirm.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<div class="sky-confirm">
<sky-modal>
<sky-modal
ariaRole="alertdialog">
<sky-modal-content>
<div class="sky-confirm-message">
{{ message }}
Expand Down
32 changes: 25 additions & 7 deletions src/modules/error/error-modal.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import { SkyErrorModalService } from './error-modal.service';
import { MockModalService } from './fixtures/mocks';
import { ErrorModalConfig } from './error-modal-config';
import { SkyErrorModalFormComponent } from './error-modal-form.component';
import {
MockModalService
} from './fixtures/mocks';
import {
SkyErrorModalService
} from './error-modal.service';
import {
ErrorModalConfig
} from './error-modal-config';
import {
SkyErrorModalFormComponent
} from './error-modal-form.component';

import {
SkyModalConfigurationInterface,
SkyModalService
} from '../modal';

describe('Error modal service', () => {
it('Test open is called with correct parameters', () => {
Expand All @@ -13,13 +26,18 @@ describe('Error modal service', () => {
errorCloseText: 'Close button text'
};

const expectedProvider = { provide: ErrorModalConfig, useValue: config };
const expectedProviders = [{ provide: ErrorModalConfig, useValue: config }];

let service = new SkyErrorModalService(modalService);
let service = new SkyErrorModalService(modalService as SkyModalService);
service.open(config);

expect(modalService.openCalls.length).toBe(1);
expect(modalService.openCalls[0].component).toBe(SkyErrorModalFormComponent);
expect(modalService.openCalls[0].providers).toEqual([expectedProvider]);

// Uses the modalService Open overload that takes config
// instead of providers (despite the property name)
let modalConfig = modalService.openCalls[0].providers as SkyModalConfigurationInterface;
expect(modalConfig.ariaRole).toBe('alertdialog');
expect(modalConfig.providers).toEqual(expectedProviders);
});
});
5 changes: 4 additions & 1 deletion src/modules/error/error-modal.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ export class SkyErrorModalService {
public open(config: ErrorModalConfig) {
const providers = [{ provide: ErrorModalConfig, useValue: config }];

this.modal.open(SkyErrorModalFormComponent, providers);
this.modal.open(SkyErrorModalFormComponent, {
ariaRole: 'alertdialog',
providers: providers
});
}
}
1 change: 1 addition & 0 deletions src/modules/modal/modal-configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export class SkyModalConfiguration {
public size?: string;
public ariaDescribedBy?: string;
public ariaLabelledBy?: string;
public ariaRole?: string;
public tiledBody?: boolean;
public helpKey?: string;

Expand Down
3 changes: 2 additions & 1 deletion src/modules/modal/modal.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

<div
class="sky-modal-dialog"
role="dialog"
aria-modal="true"
[attr.aria-describedby]="ariaDescribedBy"
[attr.aria-labelledby]="ariaLabelledBy"
[attr.role]="ariaRole"
(window:resize)="windowResize()"
>
<div class="sky-modal sky-shadow"
Expand Down
9 changes: 6 additions & 3 deletions src/modules/modal/modal.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,9 +409,10 @@ describe('Modal component', () => {
closeModal(modalInstance);
}));

it('should default the aria-labelledby and aria-describedby', fakeAsync(() => {
it('should default the role, aria-labelledby, and aria-describedby', fakeAsync(() => {
let modalInstance = openModal(ModalTestComponent);

expect(document.querySelector('.sky-modal-dialog').getAttribute('role')).toBe('dialog');
expect(document.querySelector('.sky-modal-dialog').getAttribute('aria-labelledby')
.indexOf('sky-modal-header-id-'))
.not.toBe(-1);
Expand All @@ -421,13 +422,15 @@ describe('Modal component', () => {
closeModal(modalInstance);
}));

it('should accept configuration options for aria-labelledBy and aria-describedby',
it('should accept configuration options for role, aria-labelledBy, and aria-describedby',
fakeAsync(() => {
let modalInstance = openModal(ModalTestComponent, {
'ariaLabelledBy': 'customlabelledby',
'ariaDescribedBy': 'customdescribedby'
'ariaDescribedBy': 'customdescribedby',
'ariaRole': 'alertdialog'
});

expect(document.querySelector('.sky-modal-dialog').getAttribute('role')).toBe('alertdialog');
expect(document.querySelector('.sky-modal-dialog').getAttribute('aria-labelledby'))
.toBe('customlabelledby');
expect(document.querySelector('.sky-modal-dialog').getAttribute('aria-describedby'))
Expand Down
8 changes: 8 additions & 0 deletions src/modules/modal/modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ export class SkyModalComponent implements AfterViewInit {
return this.config.tiledBody;
}

@Input()
public get ariaRole() {
return this.config.ariaRole || 'dialog';
}
public set ariaRole(value: string) {
this.config.ariaRole = value;
}

public get ariaDescribedBy() {
return this.config.ariaDescribedBy || this.modalContentId;
}
Expand Down
1 change: 1 addition & 0 deletions src/modules/modal/modal.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export interface SkyModalConfigurationInterface {
providers?: any[];
ariaDescribedBy?: string;
ariaLabelledBy?: string;
ariaRole?: string;
tiledBody?: boolean;
helpKey?: string;
}