From 3bf7d819de6d18c087108d63c0dc268b49a5a903 Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Sat, 16 Dec 2023 00:55:46 +0100 Subject: [PATCH 01/15] Fixed accessibility issues related to dso selectors - Fixed header ordering - Fixed input field not having a description what it does (because the header isn't always shown I decided to use aria-labels instead of regular labels) --- .../dso-selector/dso-selector/dso-selector.component.html | 1 + .../dso-selector/dso-selector/dso-selector.component.ts | 5 +++++ .../create-community-parent-selector.component.html | 6 +++--- .../create-item-parent-selector.component.html | 2 +- .../dso-selector-modal-wrapper.component.html | 2 +- .../edit-item-selector/edit-item-selector.component.html | 2 +- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/shared/dso-selector/dso-selector/dso-selector.component.html b/src/app/shared/dso-selector/dso-selector/dso-selector.component.html index c4f5dbc4cd6..295165d171f 100644 --- a/src/app/shared/dso-selector/dso-selector/dso-selector.component.html +++ b/src/app/shared/dso-selector/dso-selector/dso-selector.component.html @@ -2,6 +2,7 @@ diff --git a/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts b/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts index 503e4c44129..4590e05363d 100644 --- a/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts +++ b/src/app/shared/dso-selector/dso-selector/dso-selector.component.ts @@ -75,6 +75,11 @@ export class DSOSelectorComponent implements OnInit, OnDestroy { */ @Input() sort: SortOptions; + /** + * The id that should be given to the input box, this is required for accessibility reasons + */ + @Input() searchBoxId: string | null = null; + // list of allowed selectable dsoTypes typesString: string; diff --git a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.html b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.html index a13be638803..8ae146b42c4 100644 --- a/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.html +++ b/src/app/shared/dso-selector/modal-wrappers/create-community-parent-selector/create-community-parent-selector.component.html @@ -6,14 +6,14 @@ -
{{'dso-selector.create.community.sub-level' | translate}}
+ {{'dso-selector.create.community.sub-level' | translate}} diff --git a/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.html b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.html index 5fccd58f48c..5288f08e02b 100644 --- a/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.html +++ b/src/app/shared/dso-selector/modal-wrappers/create-item-parent-selector/create-item-parent-selector.component.html @@ -5,7 +5,7 @@ diff --git a/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.html b/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.html index 85d8797e660..999a96e7301 100644 --- a/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.html +++ b/src/app/shared/dso-selector/modal-wrappers/edit-item-selector/edit-item-selector.component.html @@ -5,7 +5,7 @@ From 6b204b5b535d74f76a837656e30a3a8b1fde1e36 Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Sat, 16 Dec 2023 00:56:30 +0100 Subject: [PATCH 02/15] Removed invisible buttons on the CommunityListComponent & fixed content displacement when expanding com/col --- .../community-list.component.html | 46 +++++++++---------- .../community-list.component.scss | 4 ++ .../community-list.component.spec.ts | 35 +++++++------- .../community-list.component.ts | 1 + src/assets/i18n/en.json5 | 4 ++ 5 files changed, 51 insertions(+), 39 deletions(-) create mode 100644 src/app/community-list-page/community-list/community-list.component.scss diff --git a/src/app/community-list-page/community-list/community-list.component.html b/src/app/community-list-page/community-list/community-list.component.html index eed9ca64cad..7ccf24a7619 100644 --- a/src/app/community-list-page/community-list/community-list.component.html +++ b/src/app/community-list-page/community-list/community-list.component.html @@ -4,9 +4,9 @@
- +
+ +
{{ dsoNameService.getName(node.payload) }} @@ -44,10 +47,9 @@
- + {{node.payload.shortDescription}} @@ -56,10 +58,9 @@
- +
@@ -67,9 +68,9 @@
- +
{{ dsoNameService.getName(node.payload) }}
@@ -77,10 +78,9 @@
- + {{node.payload.shortDescription}} diff --git a/src/app/community-list-page/community-list/community-list.component.scss b/src/app/community-list-page/community-list/community-list.component.scss new file mode 100644 index 00000000000..2e33380a29f --- /dev/null +++ b/src/app/community-list-page/community-list/community-list.component.scss @@ -0,0 +1,4 @@ +::ng-deep .fa-chevron-right::before { + display: block; + width: 16px; +} diff --git a/src/app/community-list-page/community-list/community-list.component.spec.ts b/src/app/community-list-page/community-list/community-list.component.spec.ts index fb47f4994d2..cec1b555ab8 100644 --- a/src/app/community-list-page/community-list/community-list.component.spec.ts +++ b/src/app/community-list-page/community-list/community-list.component.spec.ts @@ -5,7 +5,7 @@ import { CommunityListService, showMoreFlatNode, toFlatNode } from '../community import { CdkTreeModule } from '@angular/cdk/tree'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TranslateLoaderMock } from '../../shared/mocks/translate-loader.mock'; -import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; +import { CUSTOM_ELEMENTS_SCHEMA, DebugElement } from '@angular/core'; import { RouterTestingModule } from '@angular/router/testing'; import { Community } from '../../core/shared/community.model'; import { createSuccessfulRemoteDataObject$ } from '../../shared/remote-data.utils'; @@ -300,12 +300,14 @@ describe('CommunityListComponent', () => { describe('second top community node is expanded and has more children (collections) than page size of collection', () => { describe('children of second top com are added (page-limited pageSize 2)', () => { - let allNodes; + let allNodes: DebugElement[]; beforeEach(fakeAsync(() => { - const chevronExpand = fixture.debugElement.queryAll(By.css('.expandable-node button')); - const chevronExpandSpan = fixture.debugElement.queryAll(By.css('.expandable-node button span')); - if (chevronExpandSpan[1].nativeElement.classList.contains('fa-chevron-right')) { - chevronExpand[1].nativeElement.click(); + const toggleButtons: DebugElement[] = fixture.debugElement.queryAll(By.css('.expandable-node button')); + const toggleButtonText: DebugElement = toggleButtons[1].query(By.css('span')); + expect(toggleButtonText).not.toBeNull(); + + if (toggleButtonText.nativeElement.classList.contains('fa-chevron-right')) { + toggleButtons[1].nativeElement.click(); tick(); fixture.detectChanges(); } @@ -315,17 +317,18 @@ describe('CommunityListComponent', () => { allNodes = [...expandableNodesFound, ...childlessNodesFound]; })); it('tree contains 2 (page-limited) top com, 2 (page-limited) coll of 2nd top com, a show more for those page-limited coll and show more for page-limited top com', () => { - mockTopFlatnodesUnexpanded.slice(0, 2).map((topFlatnode: FlatNode) => { - expect(allNodes.find((foundEl) => { - return (foundEl.nativeElement.textContent.trim() === topFlatnode.name); - })).toBeTruthy(); - }); - mockCollectionsPage1.map((coll) => { - expect(allNodes.find((foundEl) => { - return (foundEl.nativeElement.textContent.trim() === coll.name); - })).toBeTruthy(); - }); + const allNodeNames: string[] = allNodes.map((node: DebugElement) => node.nativeElement.innerText.trim()); expect(allNodes.length).toEqual(4); + const flatNodes: string[] = mockTopFlatnodesUnexpanded.slice(0, 2).map((flatNode: FlatNode) => flatNode.name); + for (const flatNode of flatNodes) { + expect(allNodeNames).toContain(flatNode); + } + expect(flatNodes.length).toBe(2); + const page1CollectionNames: string[] = mockCollectionsPage1.map((collection: Collection) => collection.name); + for (const collectionName of page1CollectionNames) { + expect(allNodeNames).toContain(collectionName); + } + expect(page1CollectionNames.length).toBe(2); const showMoreEl = fixture.debugElement.queryAll(By.css('.show-more-node')); expect(showMoreEl.length).toEqual(2); }); diff --git a/src/app/community-list-page/community-list/community-list.component.ts b/src/app/community-list-page/community-list/community-list.component.ts index 6b5c6578e1f..031a4224692 100644 --- a/src/app/community-list-page/community-list/community-list.component.ts +++ b/src/app/community-list-page/community-list/community-list.component.ts @@ -19,6 +19,7 @@ import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; @Component({ selector: 'ds-community-list', templateUrl: './community-list.component.html', + styleUrls: ['./community-list.component.scss'], }) export class CommunityListComponent implements OnInit, OnDestroy { diff --git a/src/assets/i18n/en.json5 b/src/assets/i18n/en.json5 index 81924ab5a1b..83661180af9 100644 --- a/src/assets/i18n/en.json5 +++ b/src/assets/i18n/en.json5 @@ -1158,6 +1158,10 @@ "communityList.showMore": "Show More", + "communityList.expand": "Expand {{ name }}", + + "communityList.collapse": "Collapse {{ name }}", + "community.create.head": "Create a Community", "community.create.notifications.success": "Successfully created the Community", From cc0501f340402a2955e79d3675125caaa5ee8f4b Mon Sep 17 00:00:00 2001 From: Alexandre Vryghem Date: Sat, 16 Dec 2023 01:31:34 +0100 Subject: [PATCH 03/15] Fixed search filters having empty input buttons --- .../org-unit-input-suggestions.component.html | 4 +++- .../org-unit-input-suggestions.component.spec.ts | 2 ++ .../person-input-suggestions.component.html | 4 +++- .../dso-input-suggestions.component.html | 4 +++- .../filter-input-suggestions.component.html | 7 +++---- .../input-suggestions/input-suggestions.component.html | 4 +++- .../validation-suggestions.component.html | 4 +++- .../search-range-filter/search-range-filter.component.html | 7 +++---- 8 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-suggestions/org-unit-input-suggestions.component.html b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-suggestions/org-unit-input-suggestions.component.html index c4e31d3d81d..58f39b8d0b8 100644 --- a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-suggestions/org-unit-input-suggestions.component.html +++ b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-suggestions/org-unit-input-suggestions.component.html @@ -11,7 +11,9 @@ [dsDebounce]="debounceTime" (onDebounce)="find($event)" [placeholder]="placeholder" [ngModelOptions]="{standalone: true}" autocomplete="off"/> - +