Skip to content

Commit 4a465d2

Browse files
committed
fix(preprints): fixed accessibility issues
1 parent cba3c1a commit 4a465d2

File tree

8 files changed

+81
-30
lines changed

8 files changed

+81
-30
lines changed

src/app/features/moderation/components/my-reviewing-navigation/my-reviewing-navigation.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<h4>{{ provider().name }}</h4>
1+
<h3>{{ provider().name }}</h3>
22

33
<div class="flex flex-column gap-2 mt-2">
44
@for (tab of tabOptions; track $index) {

src/app/features/moderation/components/preprint-recent-activity-list/preprint-recent-activity-list.component.html

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,33 @@
66
<p-skeleton height="2.5rem"></p-skeleton>
77
</div>
88
} @else {
9-
<div class="overflow-auto">
10-
<div class="w-max">
11-
@for (item of reviews(); track $index) {
12-
<div
13-
class="recent-activity-item flex w-full align-items-center justify-content-between py-2 white-space-nowrap"
14-
>
15-
<div class="flex align-items-center gap-1">
16-
<osf-icon
17-
[class]="reviewStatusIcon[item.toState].value"
18-
[iconClass]="reviewStatusIcon[item.toState].icon"
19-
></osf-icon>
20-
<span class="ml-2">{{ item.creator.name }}</span>
21-
<span>{{ preprintReviewStatus[item.toState].label | translate: { name: item.preprint.name } }}</span>
22-
<span>{{ item.provider.name }}</span>
23-
</div>
24-
25-
<p class="flex flex-wrap gap-1 ml-3">
26-
{{ item.dateModified | date: 'MMM d, y h:mm a' }}
27-
</p>
9+
<div
10+
class="overflow-auto"
11+
tabindex="0"
12+
role="region"
13+
[attr.aria-label]="'project.overview.recentActivity.title' | translate"
14+
osfHorizontalScrollKeyboard
15+
>
16+
@for (item of reviews(); track $index) {
17+
<div class="recent-activity-item flex w-full align-items-center justify-content-between py-2 white-space-nowrap">
18+
<div class="flex align-items-center gap-1">
19+
<osf-icon
20+
[class]="reviewStatusIcon[item.toState].value"
21+
[iconClass]="reviewStatusIcon[item.toState].icon"
22+
></osf-icon>
23+
<span class="ml-2">{{ item.creator.name }}</span>
24+
<span>{{ preprintReviewStatus[item.toState].label | translate: { name: item.preprint.name } }}</span>
25+
<span>{{ item.provider.name }}</span>
2826
</div>
29-
}
30-
</div>
27+
28+
<p class="flex flex-wrap gap-1 ml-3">
29+
{{ item.dateModified | date: 'MMM d, y h:mm a' }}
30+
</p>
31+
</div>
32+
}
3133
</div>
3234

33-
@if (totalCount() > 10) {
35+
@if (totalCount() > rows()) {
3436
<osf-custom-paginator
3537
class="block mt-4"
3638
[first]="first()"

src/app/features/moderation/components/preprint-recent-activity-list/preprint-recent-activity-list.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.recent-activity-item {
22
border-bottom: 1px solid var(--grey-2);
3+
min-width: max-content;
34

45
&:hover {
56
background-color: var(--grey-3);

src/app/features/moderation/components/preprint-recent-activity-list/preprint-recent-activity-list.component.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,22 @@ import { ChangeDetectionStrategy, Component, input, output, signal } from '@angu
99

1010
import { CustomPaginatorComponent } from '@osf/shared/components/custom-paginator/custom-paginator.component';
1111
import { IconComponent } from '@osf/shared/components/icon/icon.component';
12+
import { HorizontalScrollKeyboardDirective } from '@osf/shared/directives/horizontal-scroll-keyboard.directive';
1213

1314
import { PreprintReviewStatus, ReviewStatusIcon } from '../../constants';
1415
import { PreprintReviewActionModel } from '../../models';
1516

1617
@Component({
1718
selector: 'osf-preprint-recent-activity-list',
18-
imports: [TableModule, DatePipe, TranslatePipe, IconComponent, Skeleton, CustomPaginatorComponent],
19+
imports: [
20+
TableModule,
21+
DatePipe,
22+
TranslatePipe,
23+
IconComponent,
24+
Skeleton,
25+
CustomPaginatorComponent,
26+
HorizontalScrollKeyboardDirective,
27+
],
1928
templateUrl: './preprint-recent-activity-list.component.html',
2029
styleUrl: './preprint-recent-activity-list.component.scss',
2130
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -28,6 +37,7 @@ export class PreprintRecentActivityListComponent {
2837
pageChanged = output<number>();
2938

3039
first = signal(0);
40+
rows = signal(10);
3141
readonly reviewStatusIcon = ReviewStatusIcon;
3242
readonly preprintReviewStatus = PreprintReviewStatus;
3343

src/app/features/preprints/pages/preprint-details/preprint-details.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import { ResetState } from '@osf/features/files/store';
3232
import { ReviewPermissions } from '@osf/shared/enums/review-permissions.enum';
3333
import { pathJoin } from '@osf/shared/helpers/path-join.helper';
3434
import { FixSpecialCharPipe } from '@osf/shared/pipes/fix-special-char.pipe';
35-
import { AnalyticsService } from '@osf/shared/services/analytics.service';
3635
import { CustomDialogService } from '@osf/shared/services/custom-dialog.service';
3736
import { DataciteService } from '@osf/shared/services/datacite/datacite.service';
3837
import { MetaTagsService } from '@osf/shared/services/meta-tags.service';
@@ -101,7 +100,6 @@ export class PreprintDetailsComponent implements OnInit, OnDestroy {
101100
private readonly metaTags = inject(MetaTagsService);
102101
private readonly datePipe = inject(DatePipe);
103102
private readonly dataciteService = inject(DataciteService);
104-
private readonly analyticsService = inject(AnalyticsService);
105103
private readonly prerenderReady = inject(PrerenderReadyService);
106104

107105
private readonly environment = inject(ENVIRONMENT);

src/app/shared/components/resource-card/resource-card.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<div class="flex align-items-center gap-2">
99
<h2>
1010
<a
11-
class="dark-blue-link word-break-word"
11+
class="block line-height-4 dark-blue-link word-break-word"
1212
[href]="resource().absoluteUrl"
1313
target="_blank"
1414
rel="noopener noreferrer"
@@ -33,7 +33,7 @@ <h2>
3333
<div class="line-height-3">
3434
@for (affiliatedEntity of affiliatedEntities().slice(0, limit); track $index) {
3535
<a
36-
class="word-break-word"
36+
class="word-break-word block line-height-3"
3737
[href]="affiliatedEntity.absoluteUrl"
3838
target="_blank"
3939
rel="noopener noreferrer"
@@ -53,7 +53,7 @@ <h2>
5353
<div class="flex flex-row gap-1 line-height-3">
5454
<p class="white-space-nowrap">{{ 'resourceCard.labels.from' | translate }}</p>
5555
<a
56-
class="white-space-normal word-break-word"
56+
class="block line-height-4 white-space-normal word-break-word"
5757
[href]="resource().isPartOf!.absoluteUrl"
5858
target="_blank"
5959
rel="noopener noreferrer"
@@ -67,7 +67,7 @@ <h2>
6767
<div class="flex flex-row gap-1 line-height-3">
6868
<p class="white-space-nowrap">{{ 'resourceCard.labels.from' | translate }}</p>
6969
<a
70-
class="white-space-normal"
70+
class="block line-height-4 white-space-normal"
7171
[href]="resource().isContainedBy!.absoluteUrl"
7272
target="_blank"
7373
rel="noopener noreferrer"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { Directive, HostListener, input } from '@angular/core';
2+
3+
@Directive({
4+
selector: '[osfHorizontalScrollKeyboard]',
5+
})
6+
export class HorizontalScrollKeyboardDirective {
7+
scrollAmount = input<number>(50);
8+
9+
@HostListener('keydown', ['$event'])
10+
onKeydown(event: KeyboardEvent): void {
11+
const container = event.currentTarget as HTMLElement;
12+
if (!container) {
13+
return;
14+
}
15+
16+
switch (event.key) {
17+
case 'ArrowRight':
18+
event.preventDefault();
19+
container.scrollBy({ left: this.scrollAmount(), behavior: 'smooth' });
20+
break;
21+
case 'ArrowLeft':
22+
event.preventDefault();
23+
container.scrollBy({ left: -this.scrollAmount(), behavior: 'smooth' });
24+
break;
25+
case 'Home':
26+
event.preventDefault();
27+
container.scrollTo({ left: 0, behavior: 'smooth' });
28+
break;
29+
case 'End':
30+
event.preventDefault();
31+
container.scrollTo({ left: container.scrollWidth, behavior: 'smooth' });
32+
break;
33+
}
34+
}
35+
}

src/styles/_base.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,9 @@
9292
margin-bottom: mix.rem(4px);
9393
font-weight: 400;
9494
}
95+
96+
*:focus-visible {
97+
outline: 1px solid var(--pr-blue-1);
98+
outline-offset: 2px;
99+
}
95100
}

0 commit comments

Comments
 (0)