Skip to content

Commit d154682

Browse files
kosarkoamadulhaxxaniCopilot
authored
UFAL/Accessibility existing issues all (ufal#139) (#1300)
* Add lang attributes to description fields Set HTML lang attributes based on metadata language for various description and metadata display elements to improve i18n and accessibility. Updated templates to bind [attr.lang] on spans, links and browse links; metadata-values now passes mdValue.language into render templates; clarin description component now emits per-entry language and value pairs; ClarinItemBoxView stores itemDescriptionLang; SidebarSearchListElement supports descriptionLang with a getDescriptionLang() hook and OrgUnit implementation returns the description language. These changes ensure displayed metadata uses the correct language attribute when available. * Improve accessibility: add ARIA labels & i18n keys Add ARIA attributes and move icon markup to improve screen-reader support across several components. Updated templates to include aria-label on interactive buttons (info, calendar, remove/save/delete/clear actions) and aria-hidden on decorative <i> icons. Adjusted calendar button markup to place the calendar icon inside the button element. Added corresponding i18n keys in many locale JSON5 files so the new labels are translatable (English provided and placeholder entries added across locales; some locales include TODO notes for translation). These changes are focused on accessibility and localization support. * Improve accessibility and semantic headings Replace several presentational heading tags with semantically appropriate heading levels (convert h4/h3/h5/h6 to h2/h3 with existing styling classes) across home, footer and item templates to improve document structure. Add aria-hidden to the hidden repository link and aria-live/aria-atomic to the pagination info for better accessibility. Update footer markup to group links into separate ULs (removing BRs) and adjust SCSS selectors to target both heading elements and .h4 class, plus spacing for stacked lists. Also add TranslateModule.forRoot() to an existing-relation-list-element spec to satisfy translations in tests. * Update cs translations: relation group, license Replace English strings with Czech translations in src/assets/i18n/cs.json5 for the following keys: form.relation-group.save, form.relation-group.delete, form.relation-group.clear, and submission.cc-license.field-info. Improves localization for relation-group actions and the CC license field. * Mark decorative paperclip icon aria-hidden Accessibility tweak: add aria-hidden="true" to the Font Awesome paperclip icon so screen readers ignore the decorative icon. Also replace the non-breaking space inside the <i> tag with a regular space between the icon and the heading text in clarin-files-section.component.html. * Normalize metadata language to BCP 47 for HTML lang attributes PR ufal#139 binds [attr.lang] straight from the DSpace metadata language field, which is stored as Java-style locales (en_US, cs_CZ) or the wildcard *. None of those are valid BCP 47 / HTML lang values, so assistive technology ignores them and the accessibility improvement is inert for the common stored values. Add a single shared metadataLangToBcp47() helper (*/empty/nullish -> null, "_" -> "-") and a thin dsLang pipe that delegates to it. Route all of PR #139's lang bindings through it: the pipe in the seven templates, the helper directly in the three .ts sites. Declare DsLangPipe in the specs that render the pipe (NO_ERRORS_SCHEMA does not suppress missing pipes), including the shared grid element test factory. Add unit specs for the helper and pipe plus a DOM assertion that en_US renders as lang="en-US". * Translate remaining English strings to Czech in cs.json5 --------- (cherry picked from commit cd1c617) Co-authored-by: Amad Ul Hassan <hassan@ufal.mff.cuni.cz> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 50a0e30 commit d154682

40 files changed

Lines changed: 252 additions & 58 deletions

File tree

src/app/clarin-navbar-top/clarin-navbar-top.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</a>
1717
</span>
1818
</div>
19-
<a class="hidden" id="repository_path" [href]="repositoryPath"></a>
19+
<a class="hidden" id="repository_path" [href]="repositoryPath" aria-hidden="true"></a>
2020
<div *ngIf="authenticatedUser != null" class="badge clarin-logout-badge px-2 py-1">
2121
<span>
2222
<a routerLink="/profile" style="color: #FFF;">

src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal-volume/journal-volume-search-result-grid-element.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ <h4 class="card-title" [innerHTML]="dsoTitle"></h4>
3131
</p>
3232
<p *ngIf="dso.hasMetadata('dc.description')" class="item-description card-text">
3333
<ds-truncatable-part [id]="dso.id" [minLines]="3">
34-
<span [innerHTML]="firstMetadataValue('dc.description')"></span>
34+
<span [innerHTML]="firstMetadataValue('dc.description')" [attr.lang]="dso.firstMetadata('dc.description')?.language | dsLang"></span>
3535
</ds-truncatable-part>
3636
</p>
3737
<div *ngIf="linkType != linkTypes.None" class="text-center">

src/app/entity-groups/journal-entities/item-grid-elements/search-result-grid-elements/journal/journal-search-result-grid-element.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ <h4 class="card-title" [innerHTML]="dsoTitle"></h4>
3535
</p>
3636
<p *ngIf="dso.hasMetadata('dc.description')" class="item-description card-text">
3737
<ds-truncatable-part [id]="dso.id" [minLines]="3">
38-
<span [innerHTML]="firstMetadataValue('dc.description')"></span>
38+
<span [innerHTML]="firstMetadataValue('dc.description')" [attr.lang]="dso.firstMetadata('dc.description')?.language | dsLang"></span>
3939
</ds-truncatable-part>
4040
</p>
4141
<div *ngIf="linkType != linkTypes.None" class="text-center">

src/app/entity-groups/research-entities/item-grid-elements/search-result-grid-elements/project/project-search-result-grid-element.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h4 class="card-title" [innerHTML]="dsoTitle"></h4>
2525
</ds-truncatable-part>
2626
<p *ngIf="dso.hasMetadata('dc.description')" class="item-description card-text text-muted">
2727
<ds-truncatable-part [id]="dso.id" [minLines]="3">
28-
<span [innerHTML]="firstMetadataValue('dc.description')"></span>
28+
<span [innerHTML]="firstMetadataValue('dc.description')" [attr.lang]="dso.firstMetadata('dc.description')?.language | dsLang"></span>
2929
</ds-truncatable-part>
3030
</p>
3131
<div *ngIf="linkType != linkTypes.None" class="text-center">

src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/org-unit/org-unit-search-result-list-element.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<span *ngIf="dso.allMetadata(['dc.description']).length > 0"
3232
class="item-list-org-unit-description">
3333
<ds-truncatable-part [id]="dso.id" [minLines]="3"><span
34-
[innerHTML]="firstMetadataValue('dc.description')"></span>
34+
[innerHTML]="firstMetadataValue('dc.description')" [attr.lang]="dso.firstMetadata('dc.description')?.language | dsLang"></span>
3535
</ds-truncatable-part>
3636
</span>
3737
</span>

src/app/entity-groups/research-entities/item-list-elements/search-result-list-elements/org-unit/org-unit-search-result-list-element.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { of as observableOf } from 'rxjs';
55
import { OrgUnitSearchResultListElementComponent } from './org-unit-search-result-list-element.component';
66
import { Item } from '../../../../../core/shared/item.model';
77
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
8+
import { DsLangPipe } from '../../../../../shared/utils/ds-lang.pipe';
89
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
910
import { ItemSearchResult } from '../../../../../shared/object-collection/shared/item-search-result.model';
1011
import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
@@ -75,7 +76,7 @@ describe('OrgUnitSearchResultListElementComponent', () => {
7576
}
7677
}
7778
)],
78-
declarations: [ OrgUnitSearchResultListElementComponent , TruncatePipe],
79+
declarations: [ OrgUnitSearchResultListElementComponent , TruncatePipe, DsLangPipe],
7980
providers: [
8081
{ provide: TruncatableService, useValue: {} },
8182
{ provide: DSONameService, useClass: DSONameServiceMock },
@@ -145,7 +146,7 @@ describe('OrgUnitSearchResultListElementComponent', () => {
145146
}
146147
}
147148
)],
148-
declarations: [OrgUnitSearchResultListElementComponent, TruncatePipe],
149+
declarations: [OrgUnitSearchResultListElementComponent, TruncatePipe, DsLangPipe],
149150
providers: [
150151
{provide: TruncatableService, useValue: {}},
151152
{provide: DSONameService, useClass: DSONameServiceMock},

src/app/entity-groups/research-entities/item-list-elements/sidebar-search-list-elements/org-unit/org-unit-sidebar-search-list-element.component.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ItemSearchResult } from '../../../../../shared/object-collection/shared
55
import { Component } from '@angular/core';
66
import { SidebarSearchListElementComponent } from '../../../../../shared/object-list/sidebar-search-list-element/sidebar-search-list-element.component';
77
import { Item } from '../../../../../core/shared/item.model';
8+
import { metadataLangToBcp47 } from '../../../../../shared/utils/metadata-language.util';
89

910
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.SideBarSearchModal)
1011
@listableObjectComponent('OrgUnitSearchResult', ViewMode.ListElement, Context.SideBarSearchModalCurrent)
@@ -24,4 +25,11 @@ export class OrgUnitSidebarSearchListElementComponent extends SidebarSearchListE
2425
getDescription(): string {
2526
return this.firstMetadataValue('dc.description');
2627
}
28+
29+
/**
30+
* Get the language of the Org Unit description.
31+
*/
32+
getDescriptionLang(): string | null {
33+
return metadataLangToBcp47(this.dso.firstMetadata('dc.description')?.language);
34+
}
2735
}

src/app/entity-groups/research-entities/metadata-representations/org-unit/org-unit-item-metadata-list-element.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<ng-template #descTemplate>
22
<span class="text-muted">
33
<span class="item-list-job-title">
4-
<span [innerHTML]="mdRepresentation.firstMetadataValue(['dc.description'])"></span>
4+
<span [innerHTML]="mdRepresentation.firstMetadataValue(['dc.description'])" [attr.lang]="mdRepresentation.firstMetadata(['dc.description'])?.language | dsLang"></span>
55
</span>
66
</span>
77
</ng-template>

src/app/entity-groups/research-entities/metadata-representations/org-unit/org-unit-item-metadata-list-element.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-rep
88
import { OrgUnitItemMetadataListElementComponent } from './org-unit-item-metadata-list-element.component';
99
import { Item } from '../../../../core/shared/item.model';
1010
import { MetadataValue } from '../../../../core/shared/metadata.models';
11+
import { DsLangPipe } from '../../../../shared/utils/ds-lang.pipe';
1112

1213
const description = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.';
1314
const organisation = 'Anonymous';
@@ -24,7 +25,7 @@ describe('OrgUnitItemMetadataListElementComponent', () => {
2425
imports:[
2526
NgbModule
2627
],
27-
declarations: [OrgUnitItemMetadataListElementComponent],
28+
declarations: [OrgUnitItemMetadataListElementComponent, DsLangPipe],
2829
schemas: [NO_ERRORS_SCHEMA]
2930
}).overrideComponent(OrgUnitItemMetadataListElementComponent, {
3031
set: { changeDetection: ChangeDetectionStrategy.Default }

src/app/footer/footer.component.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,27 @@
22
<div class="lindat-common2 lindat-common-footer">
33
<footer data-version="3.5.0" data-build="67e455771cd6a00647a289a5d7b0c8a3380d3410">
44
<div id="about-lindat">
5-
<h4><a href="https://lindat.cz/sites/default/files/2021-01/lindat_clariah_flyer.pdf">LINDAT/CLARIAH-CZ</a></h4>
5+
<h2 class="h4"><a href="https://lindat.cz/sites/default/files/2021-01/lindat_clariah_flyer.pdf">LINDAT/CLARIAH-CZ</a></h2>
66
<ul>
77
<li><a href="https://lindat.cz/files/mission-en.pdf">Mission Statement</a></li>
88
<li><a href="https://lindat.cz/ab">Advisory Board</a></li>
99
<li><a href="https://lindat.cz/events">Events</a></li>
1010
<li><a href="https://www.clarin.eu/">CLARIN Participation</a></li>
1111
<li><a href="https://www.dariah.eu/">DARIAH Participation</a></li>
12-
<br/>
12+
</ul>
13+
<ul>
1314
<li><a href="https://lindat.cz/faq-repository">FAQ</a></li>
1415
<li><a href="mailto:lindat-help@ufal.mff.cuni.cz">Helpdesk</a></li>
1516
<li><a href="https://lindat.cz/user_feedback">User Feedback Form</a></li>
16-
<br/>
17+
</ul>
18+
<ul>
1719
<li><a href="https://ufal.mff.cuni.cz/grants/lindatclariah-cz/en">Hosting Institution</a></li>
1820
<li><a href="https://lindat.cz/acknowledgement">Acknowledge LINDAT/CLARIAH-CZ</a></li>
1921
<li><a href="https://ror.org/00dd4fz34">Research Organization Registry</a></li>
2022
</ul>
2123
</div>
2224
<div id="about-partners">
23-
<h4><a href="https://lindat.cz/partners">Partners</a></h4>
25+
<h2 class="h4"><a href="https://lindat.cz/partners">Partners</a></h2>
2426
<ul>
2527
<li>Charles University
2628
<ul>
@@ -66,7 +68,7 @@ <h4><a href="https://lindat.cz/partners">Partners</a></h4>
6668
</ul>
6769
</div>
6870
<div id="about-website">
69-
<h4><a href="https://lindat.cz/services">Services</a></h4>
71+
<h2 class="h4"><a href="https://lindat.cz/services">Services</a></h2>
7072
<ul>
7173
<li><a href="https://lindat.mff.cuni.cz/en/monitoring">Service Status</a></li>
7274
<li><a href="https://lindat.mff.cuni.cz/repository/static/about">About and Policies</a></li>

0 commit comments

Comments
 (0)