Skip to content

Commit 30fe424

Browse files
Fixed browse by vocabulary treeview accessibility issues
1 parent 8ba17c9 commit 30fe424

4 files changed

Lines changed: 16 additions & 15 deletions

File tree

src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.html

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
<ds-alert [content]="'vocabulary-treeview.info' | translate" [type]="'alert-info'"></ds-alert>
2-
<div class="treeview-header row">
1+
<ds-alert [content]="'vocabulary-treeview.info' | translate" [type]="AlertType.Info"></ds-alert>
2+
<div class="treeview-header row mb-1">
33
<div class="col-12">
44
<div class="input-group">
5-
<input type="text" class="form-control" [(ngModel)]="searchText" (keyup.enter)="search()">
5+
<input type="text" class="form-control" [(ngModel)]="searchText" (keyup.enter)="search()"
6+
[placeholder]="'vocabulary-treeview.search.form.search-placeholder' | translate">
67
<div class="input-group-append" id="button-addon4">
78
<button class="btn btn-outline-primary" type="button" (click)="search()" [disabled]="!isSearchEnabled()">
89
{{'vocabulary-treeview.search.form.search' | translate}}
@@ -19,15 +20,15 @@
1920
</div>
2021
<div class="treeview-container">
2122
<ds-themed-loading *ngIf="loading | async" [showMessage]="false"></ds-themed-loading>
22-
<h4 *ngIf="!(loading | async) && dataSource.data.length === 0" class="text-center text-muted mt-4" >
23+
<h2 *ngIf="!(loading | async) && dataSource.data.length === 0" class="h4 text-center text-muted mt-4" >
2324
<span>{{'vocabulary-treeview.search.no-result' | translate}}</span>
24-
</h4>
25+
</h2>
2526
<cdk-tree [dataSource]="dataSource" [treeControl]="treeControl">
2627
<!-- Leaf node -->
2728
<cdk-tree-node *cdkTreeNodeDef="let node" cdkTreeNodePadding class="d-flex">
28-
<button type="button" class="btn btn-default" cdkTreeNodeToggle>
29-
<span class="fas fa-fw fa-angle-right invisible" aria-hidden="true"></span>
30-
</button>
29+
<span aria-hidden="true" type="button" class="btn btn-default px-2 mr-1" cdkTreeNodeToggle>
30+
<i class="fas fa-fw fa-angle-right invisible"></i>
31+
</span>
3132
<label *ngIf="multiSelect" class="d-flex align-items-center m-0 p-0 form-check"
3233
[class.text-success]="node.isSelected"
3334
[ngbTooltip]="node.item?.otherInformation?.note"
@@ -55,11 +56,10 @@ <h4 *ngIf="!(loading | async) && dataSource.data.length === 0" class="text-cente
5556

5657
<!-- expandable node -->
5758
<cdk-tree-node *cdkTreeNodeDef="let node; when: hasChildren" cdkTreeNodePadding class="d-flex">
58-
<button type="button" class="btn btn-default" cdkTreeNodeToggle
59+
<button type="button" class="btn btn-default px-2 mr-1" cdkTreeNodeToggle
5960
[attr.aria-label]="'toggle ' + node.name"
6061
(click)="loadChildren(node)">
61-
<span class="fas fa-fw {{treeControl.isExpanded(node) ? 'fa-angle-down' : 'fa-angle-right'}}"
62-
aria-hidden="true"></span>
62+
<i class="fas fa-fw {{treeControl.isExpanded(node) ? 'fa-angle-down' : 'fa-angle-right'}}"></i>
6363
</button>
6464

6565
<label *ngIf="multiSelect" class="d-flex align-items-center m-0 p-0 form-check"

src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
text-align:left;
33
}
44

5-
cdk-tree .btn:focus {
6-
box-shadow: none !important;
7-
}
8-
95
label {
106
cursor: pointer;
117
}

src/app/shared/form/vocabulary-treeview/vocabulary-treeview.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { VocabularyTreeFlatDataSource } from './vocabulary-tree-flat-data-source
1717
import { CoreState } from '../../../core/core-state.model';
1818
import { VocabularyService } from '../../../core/submission/vocabularies/vocabulary.service';
1919
import { getFirstSucceededRemoteDataPayload } from '../../../core/shared/operators';
20+
import { AlertType } from '../../alert/alert-type';
2021

2122
/**
2223
* Component that shows a hierarchical vocabulary in a tree view
@@ -105,6 +106,8 @@ export class VocabularyTreeviewComponent implements OnDestroy, OnInit, OnChanges
105106
*/
106107
private subs: Subscription[] = [];
107108

109+
readonly AlertType = AlertType;
110+
108111
/**
109112
* Initialize instance variables
110113
*

src/assets/i18n/en.json5

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4790,6 +4790,8 @@
47904790

47914791
"vocabulary-treeview.search.form.search": "Search",
47924792

4793+
"vocabulary-treeview.search.form.search-placeholder": "Filter results by typing the first few letters",
4794+
47934795
"vocabulary-treeview.search.no-result": "There were no items to show",
47944796

47954797
"vocabulary-treeview.tree.description.nsi": "The Norwegian Science Index",

0 commit comments

Comments
 (0)