From e444a0619df21a0ffd43f00b7debe0574e0037ac Mon Sep 17 00:00:00 2001 From: nsemets Date: Tue, 1 Dec 2026 11:08:33 +0200 Subject: [PATCH] fix(project-settings): fixed accessibility issue --- .../project-detail-setting-accordion.component.html | 8 +++++--- ...project-detail-setting-accordion.component.spec.ts | 11 ++--------- .../project-detail-setting-accordion.component.ts | 7 +++---- .../project-setting-notifications.component.ts | 4 ++-- .../settings-wiki-card.component.ts | 4 ++-- .../project/settings/models/right-control.model.ts | 5 +++++ 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.html b/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.html index aa0da4d82..01c4e39d3 100644 --- a/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.html +++ b/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.html @@ -1,15 +1,17 @@
-
+
- {{ title() }} + {{ title() }}
@if (rightControls()) { @@ -17,7 +19,7 @@ @for (control of rightControls(); let index = $index; track index) {
@if (control.label) { - + {{ control.label | translate }} } diff --git a/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.spec.ts b/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.spec.ts index 8be142fd5..ca416a136 100644 --- a/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.spec.ts +++ b/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.spec.ts @@ -20,17 +20,10 @@ describe('ProjectDetailSettingAccordionComponent', () => { fixture = TestBed.createComponent(ProjectDetailSettingAccordionComponent); component = fixture.componentInstance; + fixture.componentRef.setInput('rightControls', []); }); - it('should create', () => { - expect(component).toBeTruthy(); - }); - - it('should initialize with expanded set to false', () => { - expect(component.expanded()).toBe(false); - }); - - it('should toggle expanded state when toggle() is called', () => { + it('should toggle expanded state', () => { expect(component.expanded()).toBe(false); component.toggle(); diff --git a/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.ts b/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.ts index f95e6ed6e..40480031b 100644 --- a/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.ts +++ b/src/app/features/project/settings/components/project-detail-setting-accordion/project-detail-setting-accordion.component.ts @@ -3,20 +3,19 @@ import { TranslatePipe } from '@ngx-translate/core'; import { Button } from 'primeng/button'; import { ChangeDetectionStrategy, Component, input, output, signal } from '@angular/core'; -import { FormsModule } from '@angular/forms'; import { SelectComponent } from '@osf/shared/components/select/select.component'; -import { RightControl } from '../../models'; +import { RightControl, RightControlValueChange } from '../../models'; @Component({ selector: 'osf-project-detail-setting-accordion', - imports: [FormsModule, Button, SelectComponent, TranslatePipe], + imports: [Button, SelectComponent, TranslatePipe], templateUrl: './project-detail-setting-accordion.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) export class ProjectDetailSettingAccordionComponent { - emitValueChange = output<{ index: number; value: boolean | string }>(); + emitValueChange = output(); title = input(); rightControls = input.required(); disabledRightControls = input(false); diff --git a/src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.ts b/src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.ts index 60b08d172..507147e0d 100644 --- a/src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.ts +++ b/src/app/features/project/settings/components/project-setting-notifications/project-setting-notifications.component.ts @@ -11,7 +11,7 @@ import { SubscriptionEvent } from '@osf/shared/enums/subscriptions/subscription- import { SubscriptionFrequency } from '@osf/shared/enums/subscriptions/subscription-frequency.enum'; import { NotificationSubscription } from '@osf/shared/models/notifications/notification-subscription.model'; -import { RightControl } from '../../models'; +import { RightControl, RightControlValueChange } from '../../models'; import { NotificationDescriptionPipe } from '../../pipes'; import { ProjectDetailSettingAccordionComponent } from '../project-detail-setting-accordion/project-detail-setting-accordion.component'; @@ -52,7 +52,7 @@ export class ProjectSettingNotificationsComponent { }); } - changeEmittedValue(emittedValue: { index: number; value: boolean | string }): void { + changeEmittedValue(emittedValue: RightControlValueChange): void { if (this.allAccordionData) { this.notificationEmitValue.emit({ id: this.notifications()[0].id, diff --git a/src/app/features/project/settings/components/settings-wiki-card/settings-wiki-card.component.ts b/src/app/features/project/settings/components/settings-wiki-card/settings-wiki-card.component.ts index 9c341b5fb..5b0643225 100644 --- a/src/app/features/project/settings/components/settings-wiki-card/settings-wiki-card.component.ts +++ b/src/app/features/project/settings/components/settings-wiki-card/settings-wiki-card.component.ts @@ -11,7 +11,7 @@ import { FormsModule } from '@angular/forms'; import { UserSelectors } from '@osf/core/store/user/user.selectors'; -import { RightControl } from '../../models'; +import { RightControl, RightControlValueChange } from '../../models'; import { ProjectDetailSettingAccordionComponent } from '../project-detail-setting-accordion/project-detail-setting-accordion.component'; @Component({ @@ -51,7 +51,7 @@ export class SettingsWikiCardComponent { }); } - changeEmittedValue(emittedValue: { index: number; value: boolean | string }): void { + changeEmittedValue(emittedValue: RightControlValueChange): void { if (typeof emittedValue.value === 'boolean') { this.anyoneCanEditWikiEmitValue.emit(emittedValue.value); } diff --git a/src/app/features/project/settings/models/right-control.model.ts b/src/app/features/project/settings/models/right-control.model.ts index 77e0af7fc..0ff85a430 100644 --- a/src/app/features/project/settings/models/right-control.model.ts +++ b/src/app/features/project/settings/models/right-control.model.ts @@ -8,3 +8,8 @@ export interface RightControl { options: SelectOption[]; event?: SubscriptionEvent; } + +export interface RightControlValueChange { + index: number; + value: boolean | string; +}