Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Ensure label click subscription is only registered once

Kabiru Mwenja6158ae4b9367
diff --git a/frontend/src/app/shared/components/editor/components/ckeditor-augmented-textarea/ckeditor-augmented-textarea.component.ts b/frontend/src/app/shared/components/editor/components/ckeditor-augmented-textarea/ckeditor-augmented-textarea.component.ts
index 1e6921c0c05..abf25e8a1c4 100644
--- a/frontend/src/app/shared/components/editor/components/ckeditor-augmented-textarea/ckeditor-augmented-textarea.component.ts
+++ b/frontend/src/app/shared/components/editor/components/ckeditor-augmented-textarea/ckeditor-augmented-textarea.component.ts
@@ -54,13 +54,12 @@ import {
ICKEditorContext,
ICKEditorInstance,
} from 'core-app/shared/components/editor/components/ckeditor/ckeditor.types';
-import { fromEvent } from 'rxjs';
+import { fromEvent, Subscription } from 'rxjs';
import { AttachmentCollectionResource } from 'core-app/features/hal/resources/attachment-collection-resource';
import { populateInputsFromDataset } from 'core-app/shared/components/dataset-inputs';
import { navigator } from '@hotwired/turbo';
import { uniqueId } from 'lodash';
-
@Component({
templateUrl: './ckeditor-augmented-textarea.html',
changeDetection: ChangeDetectionStrategy.OnPush,
@@ -127,6 +126,8 @@ export class CkeditorAugmentedTextareaComponent extends UntilDestroyedMixin impl
private attachments:HalResource[];
+ private labelClickSubscription:Subscription;
+
constructor(
readonly elementRef:ElementRef<HTMLElement>,
protected pathHelper:PathHelperService,
@@ -315,9 +316,11 @@ export class CkeditorAugmentedTextareaComponent extends UntilDestroyedMixin impl
ckContent.removeAttribute('aria-label');
ckContent.setAttribute('aria-labelledby', labelId);
- fromEvent(label, 'click')
- .pipe(this.untilDestroyed())
- .subscribe(() => ckContent.focus());
+ if (!this.labelClickSubscription) {
+ this.labelClickSubscription = fromEvent(label, 'click')
+ .pipe(this.untilDestroyed())
+ .subscribe(() => ckContent.focus());
+ }
} else if (this.textAreaAriaLabel) {
ckContent.setAttribute('aria-label', this.textAreaAriaLabel);
} else {