Skip to content

Commit bde12ba

Browse files
author
Jens Vannerum
committed
Merge branch 'w2p-117544_support-for-disabled-elements-for-screen-readers-8.0' into w2p-117544_support-for-disabled-elements-for-screen-readers-9.0
2 parents ee7e835 + b6df0c9 commit bde12ba

190 files changed

Lines changed: 636 additions & 268 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/app/access-control/bulk-access/bulk-access.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h1>{{ 'admin.access-control.bulk-access.title' | translate }}</h1>
1010
<button class="btn btn-outline-primary mr-3" (click)="reset()">
1111
{{ 'access-control-cancel' | translate }}
1212
</button>
13-
<button class="btn btn-primary" [disabled]="!canExport()" (click)="submit()">
13+
<button class="btn btn-primary" [dsDisabled]="!canExport()" (click)="submit()">
1414
{{ 'access-control-execute' | translate }}
1515
</button>
1616
</div>

src/app/access-control/bulk-access/bulk-access.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from 'rxjs/operators';
1515

1616
import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service';
17+
import { DisabledDirective } from '../../shared/disabled-directive';
1718
import { SelectableListState } from '../../shared/object-list/selectable-list/selectable-list.reducer';
1819
import { SelectableListService } from '../../shared/object-list/selectable-list/selectable-list.service';
1920
import { BulkAccessBrowseComponent } from './browse/bulk-access-browse.component';
@@ -27,6 +28,7 @@ import { BulkAccessSettingsComponent } from './settings/bulk-access-settings.com
2728
TranslateModule,
2829
BulkAccessSettingsComponent,
2930
BulkAccessBrowseComponent,
31+
DisabledDirective,
3032
],
3133
standalone: true,
3234
})

src/app/access-control/epeople-registry/epeople-registry.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { EPersonDataService } from '../../core/eperson/eperson-data.service';
4242
import { EPerson } from '../../core/eperson/models/eperson.model';
4343
import { PaginationService } from '../../core/pagination/pagination.service';
4444
import { PageInfo } from '../../core/shared/page-info.model';
45+
import { DisabledDirective } from '../../shared/disabled-directive';
4546
import { FormBuilderService } from '../../shared/form/builder/form-builder.service';
4647
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
4748
import { getMockFormBuilderService } from '../../shared/mocks/form-builder-service.mock';
@@ -151,7 +152,7 @@ describe('EPeopleRegistryComponent', () => {
151152
paginationService = new PaginationServiceStub();
152153
TestBed.configureTestingModule({
153154
imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule, RouterTestingModule.withRoutes([]),
154-
TranslateModule.forRoot(), EPeopleRegistryComponent],
155+
TranslateModule.forRoot(), EPeopleRegistryComponent, DisabledDirective],
155156
providers: [
156157
{ provide: EPersonDataService, useValue: ePersonDataServiceStub },
157158
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h1 class="border-bottom pb-2">{{messagePrefix + '.edit' | translate}}</h1>
2525
</button>
2626
</div>
2727
<div *ngIf="displayResetPassword" between class="btn-group">
28-
<button class="btn btn-primary" [disabled]="(canReset$ | async) !== true" type="button" (click)="resetPassword()">
28+
<button class="btn btn-primary" [dsDisabled]="(canReset$ | async) !== true" type="button" (click)="resetPassword()">
2929
<i class="fa fa-key"></i> {{'admin.access-control.epeople.actions.reset' | translate}}
3030
</button>
3131
</div>

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { GroupDataService } from '../../../core/eperson/group-data.service';
4545
import { EPerson } from '../../../core/eperson/models/eperson.model';
4646
import { PaginationService } from '../../../core/pagination/pagination.service';
4747
import { PageInfo } from '../../../core/shared/page-info.model';
48+
import { DisabledDirective } from '../../../shared/disabled-directive';
4849
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
4950
import { FormComponent } from '../../../shared/form/form.component';
5051
import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component';
@@ -227,7 +228,7 @@ describe('EPersonFormComponent', () => {
227228
route = new ActivatedRouteStub();
228229
router = new RouterStub();
229230
TestBed.configureTestingModule({
230-
imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule,
231+
imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, DisabledDirective, BrowserModule,
231232
TranslateModule.forRoot({
232233
loader: {
233234
provide: TranslateLoader,
@@ -546,7 +547,8 @@ describe('EPersonFormComponent', () => {
546547
// ePersonDataServiceStub.activeEPerson = eperson;
547548
spyOn(component.epersonService, 'deleteEPerson').and.returnValue(createSuccessfulRemoteDataObject$('No Content', 204));
548549
const deleteButton = fixture.debugElement.query(By.css('.delete-button'));
549-
expect(deleteButton.nativeElement.disabled).toBe(false);
550+
expect(deleteButton.nativeElement.getAttribute('aria-disabled')).toBeNull();
551+
expect(deleteButton.nativeElement.classList.contains('disabled')).toBeFalse();
550552
deleteButton.triggerEventHandler('click', null);
551553
fixture.detectChanges();
552554
expect(component.epersonService.deleteEPerson).toHaveBeenCalledWith(eperson);

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import { PageInfo } from '../../../core/shared/page-info.model';
6666
import { Registration } from '../../../core/shared/registration.model';
6767
import { TYPE_REQUEST_FORGOT } from '../../../register-email-form/register-email-form.component';
6868
import { ConfirmationModalComponent } from '../../../shared/confirmation-modal/confirmation-modal.component';
69+
import { DisabledDirective } from '../../../shared/disabled-directive';
6970
import { hasValue } from '../../../shared/empty.util';
7071
import { FormBuilderService } from '../../../shared/form/builder/form-builder.service';
7172
import { FormComponent } from '../../../shared/form/form.component';
@@ -92,6 +93,7 @@ import { ValidateEmailNotTaken } from './validators/email-taken.validator';
9293
PaginationComponent,
9394
RouterLink,
9495
HasNoValuePipe,
96+
DisabledDirective,
9597
],
9698
standalone: true,
9799
})

src/app/access-control/group-registry/group-form/members-list/members-list.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ <h3>{{messagePrefix + '.headMembers' | translate}}</h3>
3535
<div class="btn-group edit-field">
3636
<button (click)="deleteMemberFromGroup(epersonDTO.eperson)"
3737
*ngIf="epersonDTO.ableToDelete"
38-
[disabled]="actionConfig.remove.disabled"
38+
[dsDisabled]="actionConfig.remove.disabled"
3939
[ngClass]="['btn btn-sm', actionConfig.remove.css]"
4040
title="{{messagePrefix + '.table.edit.buttons.remove' | translate: { name: dsoNameService.getName(epersonDTO.eperson) } }}">
4141
<i [ngClass]="actionConfig.remove.icon"></i>
4242
</button>
4343
<button *ngIf="!epersonDTO.ableToDelete"
4444
(click)="addMemberToGroup(epersonDTO.eperson)"
45-
[disabled]="actionConfig.add.disabled"
45+
[dsDisabled]="actionConfig.add.disabled"
4646
[ngClass]="['btn btn-sm', actionConfig.add.css]"
4747
title="{{messagePrefix + '.table.edit.buttons.add' | translate: { name: dsoNameService.getName(epersonDTO.eperson) } }}">
4848
<i [ngClass]="actionConfig.add.icon"></i>
@@ -122,7 +122,7 @@ <h3 id="search" class="border-bottom pb-2">
122122
<td class="align-middle">
123123
<div class="btn-group edit-field">
124124
<button (click)="addMemberToGroup(eperson)"
125-
[disabled]="actionConfig.add.disabled"
125+
[dsDisabled]="actionConfig.add.disabled"
126126
[ngClass]="['btn btn-sm', actionConfig.add.css]"
127127
title="{{messagePrefix + '.table.edit.buttons.add' | translate: { name: dsoNameService.getName(eperson) } }}">
128128
<i [ngClass]="actionConfig.add.icon"></i>

src/app/access-control/group-registry/group-form/members-list/members-list.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import {
5555
getRemoteDataPayload,
5656
} from '../../../../core/shared/operators';
5757
import { ContextHelpDirective } from '../../../../shared/context-help.directive';
58+
import { DisabledDirective } from '../../../../shared/disabled-directive';
5859
import { NotificationsService } from '../../../../shared/notifications/notifications.service';
5960
import { PaginationComponent } from '../../../../shared/pagination/pagination.component';
6061
import { PaginationComponentOptions } from '../../../../shared/pagination/pagination-component-options.model';
@@ -113,6 +114,7 @@ export interface EPersonListActionConfig {
113114
RouterLink,
114115
NgClass,
115116
NgForOf,
117+
DisabledDirective,
116118
],
117119
standalone: true,
118120
})

src/app/access-control/group-registry/groups-registry.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ <h2 id="search" class="border-bottom pb-2">{{messagePrefix + 'search.head' | tra
6969
<i class="fas fa-edit fa-fw"></i>
7070
</button>
7171
<button *ngSwitchCase="false"
72-
[disabled]="true"
72+
[dsDisabled]="true"
7373
class="btn btn-outline-primary btn-sm btn-edit"
7474
placement="left"
7575
[ngbTooltip]="'admin.access-control.epeople.table.edit.buttons.edit-disabled' | translate"

src/app/access-control/group-registry/groups-registry.component.spec.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import { RouteService } from '../../core/services/route.service';
5050
import { DSpaceObject } from '../../core/shared/dspace-object.model';
5151
import { NoContent } from '../../core/shared/NoContent.model';
5252
import { PageInfo } from '../../core/shared/page-info.model';
53+
import { DisabledDirective } from '../../shared/disabled-directive';
5354
import {
5455
DSONameServiceMock,
5556
UNDEFINED_NAME,
@@ -208,6 +209,7 @@ describe('GroupsRegistryComponent', () => {
208209
imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, BrowserModule,
209210
TranslateModule.forRoot(),
210211
GroupsRegistryComponent,
212+
DisabledDirective,
211213
],
212214
providers: [GroupsRegistryComponent,
213215
{ provide: DSONameService, useValue: new DSONameServiceMock() },
@@ -278,7 +280,8 @@ describe('GroupsRegistryComponent', () => {
278280
const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups tr td:nth-child(5) button.btn-edit'));
279281
expect(editButtonsFound.length).toEqual(2);
280282
editButtonsFound.forEach((editButtonFound) => {
281-
expect(editButtonFound.nativeElement.disabled).toBeFalse();
283+
expect(editButtonFound.nativeElement.getAttribute('aria-disabled')).toBeNull();
284+
expect(editButtonFound.nativeElement.classList.contains('disabled')).toBeFalse();
282285
});
283286
});
284287

@@ -312,7 +315,8 @@ describe('GroupsRegistryComponent', () => {
312315
const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups tr td:nth-child(5) button.btn-edit'));
313316
expect(editButtonsFound.length).toEqual(2);
314317
editButtonsFound.forEach((editButtonFound) => {
315-
expect(editButtonFound.nativeElement.disabled).toBeFalse();
318+
expect(editButtonFound.nativeElement.getAttribute('aria-disabled')).toBeNull();
319+
expect(editButtonFound.nativeElement.classList.contains('disabled')).toBeFalse();
316320
});
317321
});
318322
});
@@ -331,7 +335,8 @@ describe('GroupsRegistryComponent', () => {
331335
const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups tr td:nth-child(5) button.btn-edit'));
332336
expect(editButtonsFound.length).toEqual(2);
333337
editButtonsFound.forEach((editButtonFound) => {
334-
expect(editButtonFound.nativeElement.disabled).toBeTrue();
338+
expect(editButtonFound.nativeElement.getAttribute('aria-disabled')).toBe('true');
339+
expect(editButtonFound.nativeElement.classList.contains('disabled')).toBeTrue();
335340
});
336341
});
337342
});

0 commit comments

Comments
 (0)