Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add missing assistive text to professional activities and sort type #2002

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions src/app/cdk/panel/panels/panels.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ <h3 class="activity-header orc-font-body-large">
mat-menu-item
(click)="sortChange(option)"
*ngFor="let option of sortTypes"
[attr.aria-label]="option | appPanelsSortByAriaLabel"
>
{{ option | sortLabel }}
<mat-icon
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export class AppPanelsAddAriaLabelPipe implements PipeTransform {
transform(panelType: any, args?: any): string {
if (panelType == 'employment') {
return $localize`:@@shared.employmentAddAriaLabel:Add employment`
} else if (panelType == 'professional-activities') {
return $localize`:@@shared.addProfessionalActivity:Add a professional activity `
} else if (panelType == 'education' || panelType == 'qualification') {
return $localize`:@@shared.educationQualificationAddAriaLabel:Add education or qualification`
} else if (panelType == 'distinction' || panelType == 'invited-position') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ export class AppPanelsSortAriaLabelPipe implements PipeTransform {
$localize`:@@shared.employmentSortAriaLabel:Sort your employment` +
disabledStr
)
} else if (panelType === 'professional-activities') {
return (
$localize`:@@shared.sortProfessionalActivities:Sort your professional activities` +
disabledStr
)
} else if (panelType === 'education' || panelType === 'qualification') {
return (
$localize`:@@shared.educationQualificationSortAriaLabel:Sort your education and qualifications` +
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { AppPanelsSortByAriaLabelPipe } from './app-panels-sort-by-aria-label.pipe';

describe('AppPanelsSortByAriaLabelPipe', () => {
it('create an instance', () => {
const pipe = new AppPanelsSortByAriaLabelPipe();
expect(pipe).toBeTruthy();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Pipe, PipeTransform } from '@angular/core';
import { SortOrderType } from '../../../types/sort'

@Pipe({
name: 'appPanelsSortByAriaLabel'
})
export class AppPanelsSortByAriaLabelPipe implements PipeTransform {

transform(sortBy: SortOrderType): string {
switch (sortBy) {
case 'title':
return $localize`:@@shared.sortTitle:Sort by title`
case 'start':
return $localize`:@@shared.sortStart:Sort by start date`
case 'end':
return $localize`:@@shared.sortEnd:Sort by end date`
case 'date':
return $localize`:@@shared.sortDate:Sort by type`
case 'type':
return $localize`:@@shared.sortType:Sort by type`
case 'order':
return $localize`:@@shared.sortOrder:Sort by order`
}
}
}
5 changes: 4 additions & 1 deletion src/app/shared/shared.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ import { AppPanelActivityActionAriaLabelPipe } from './pipes/app-panel-activity-
import { SortByPipe } from './pipes/sort-by/sort-by.pipe'
import { AffiliationLabelPipe } from './pipes/affiliation-label.pipe'
import { AffiliationTypePipe } from './pipes/affiliation-type/affiliation-type.pipe'
import { ScopePathTypePipe } from './pipes/scope-path-type/scope-path-type.pipe'
import { ScopePathTypePipe } from './pipes/scope-path-type/scope-path-type.pipe';
import { AppPanelsSortByAriaLabelPipe } from './pipes/app-panels-sort-by-aria-label/app-panels-sort-by-aria-label.pipe'
@NgModule({
imports: [
CommonModule,
Expand Down Expand Up @@ -97,6 +98,7 @@ import { ScopePathTypePipe } from './pipes/scope-path-type/scope-path-type.pipe'
AffiliationLabelPipe,
AffiliationTypePipe,
ScopePathTypePipe,
AppPanelsSortByAriaLabelPipe,
],
exports: [
CommonModule,
Expand Down Expand Up @@ -143,6 +145,7 @@ import { ScopePathTypePipe } from './pipes/scope-path-type/scope-path-type.pipe'
SortByPipe,
AffiliationTypePipe,
ScopePathTypePipe,
AppPanelsSortByAriaLabelPipe,
],
providers: [], // Should not provide anything
})
Expand Down
8 changes: 8 additions & 0 deletions src/locale/properties/shared/shared.en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -598,3 +598,11 @@ share.selfService=Self Service - ORCID
share.orcidTitle=- ORCID
share.myOrcidTitle=- My ORCID
share.developerTools=Developer tools - ORCID
shared.addProfessionalActivity=Add a professional activity
shared.sortProfessionalActivities=Sort your professional activities
shared.sortTitle=Sort by title
shared.sortStart=Sort by start date
shared.sortEnd=Sort by end date
shared.sortType=Sort by type
shared.sortDate=Sort by type
shared.sortOrder=Sort by order