diff --git a/projects/v3/src/app/pages/chat/chat-list/chat-list.component.spec.ts b/projects/v3/src/app/pages/chat/chat-list/chat-list.component.spec.ts
index 2b0f03367..bc4e35347 100644
--- a/projects/v3/src/app/pages/chat/chat-list/chat-list.component.spec.ts
+++ b/projects/v3/src/app/pages/chat/chat-list/chat-list.component.spec.ts
@@ -190,4 +190,27 @@ describe('ChatListComponent', () => {
});
});
+ describe('accessible chat text', () => {
+ beforeEach(() => {
+ (utils.decodeHtmlEntities as jasmine.Spy).and.callFake((value: string) =>
+ UtilsService.prototype.decodeHtmlEntities.call({ document }, value));
+ });
+
+ it('decodes entities and separates HTML blocks', () => {
+ expect(component.plainText('
A & B
Next
line
')).toBe('A & B Next line');
+ expect(component.plainText('')).toBe('');
+ });
+
+ it('keeps HTML event handlers inert when extracting a message label', async () => {
+ const marker = '__pr2808MessageExecuted';
+ (window as any)[marker] = false;
+ try {
+ expect(component.plainText(`Hello
`)).toBe('Hello');
+ await new Promise(resolve => setTimeout(resolve, 100));
+ expect((window as any)[marker]).toBeFalse();
+ } finally {
+ delete (window as any)[marker];
+ }
+ });
+ });
});
diff --git a/projects/v3/src/app/pages/chat/chat-list/chat-list.component.ts b/projects/v3/src/app/pages/chat/chat-list/chat-list.component.ts
index 5ddc81f64..2fe55e3d1 100644
--- a/projects/v3/src/app/pages/chat/chat-list/chat-list.component.ts
+++ b/projects/v3/src/app/pages/chat/chat-list/chat-list.component.ts
@@ -1,4 +1,5 @@
-import { ChangeDetectorRef, Component, Output, EventEmitter, NgZone, Input, OnDestroy } from '@angular/core';
+import { DOCUMENT } from '@angular/common';
+import { Inject, ChangeDetectorRef, Component, Output, EventEmitter, NgZone, Input, OnDestroy } from '@angular/core';
import { Router, NavigationExtras } from '@angular/router';
import { BrowserStorageService } from '@v3/services/storage.service';
import { UtilsService } from '@v3/services/utils.service';
@@ -32,7 +33,8 @@ export class ChatListComponent implements OnDestroy {
private storage: BrowserStorageService,
private ngZone: NgZone,
private cdr: ChangeDetectorRef,
- private pusherService: PusherService
+ private pusherService: PusherService,
+ @Inject(DOCUMENT) private document: Document
) {
this.isMobile = this.utils.isMobile();
this.utils.getEvent('chat:new-message')
@@ -158,7 +160,10 @@ export class ChatListComponent implements OnDestroy {
const withBreaks = value
.replace(/
/gi, ' ')
.replace(/<\/(p|div|li|h[1-6])>/gi, ' ');
- return this.utils.decodeHtmlEntities(withBreaks).replace(/\s+/g, ' ').trim();
+ // Template contents are inert: message images and event handlers never activate.
+ const template = this.document.createElement('template');
+ template.innerHTML = withBreaks;
+ return (template.content.textContent || '').replace(/\s+/g, ' ').trim();
}
}
diff --git a/projects/v3/src/app/pages/chat/chat-room/chat-room.component.html b/projects/v3/src/app/pages/chat/chat-room/chat-room.component.html
index 7d9b53ec2..47b66dd16 100644
--- a/projects/v3/src/app/pages/chat/chat-room/chat-room.component.html
+++ b/projects/v3/src/app/pages/chat/chat-room/chat-room.component.html
@@ -182,7 +182,7 @@
-
diff --git a/projects/v3/src/app/pages/chat/chat-room/chat-room.component.spec.ts b/projects/v3/src/app/pages/chat/chat-room/chat-room.component.spec.ts
index 3d36ff9ee..454ae28fc 100644
--- a/projects/v3/src/app/pages/chat/chat-room/chat-room.component.spec.ts
+++ b/projects/v3/src/app/pages/chat/chat-room/chat-room.component.spec.ts
@@ -791,4 +791,16 @@ describe('ChatRoomComponent', () => {
});
});
+ it('labels the created editable root rather than a message preview', () => {
+ const preview = document.createElement('div');
+ preview.className = 'ql-editor';
+ fixture.nativeElement.prepend(preview);
+ const root = document.createElement('div');
+ root.contentEditable = 'true';
+ (component.labelMessageEditor as any)({ root });
+ expect(root.getAttribute('role')).toBe('textbox');
+ expect(root.getAttribute('aria-multiline')).toBe('true');
+ expect(root.getAttribute('aria-label')).toBe('Enter your message');
+ expect(preview.hasAttribute('role')).toBeFalse();
+ });
});
diff --git a/projects/v3/src/app/pages/chat/chat-room/chat-room.component.ts b/projects/v3/src/app/pages/chat/chat-room/chat-room.component.ts
index 54b976b3d..d41dee0df 100644
--- a/projects/v3/src/app/pages/chat/chat-room/chat-room.component.ts
+++ b/projects/v3/src/app/pages/chat/chat-room/chat-room.component.ts
@@ -14,6 +14,7 @@ import { EditMessagePopupComponent } from '../edit-message-popup/edit-message-po
import { Subject, Subscription, timer } from 'rxjs';
import { debounceTime, switchMap, takeUntil, tap } from 'rxjs/operators';
import { QuillModules } from 'ngx-quill';
+import type Quill from 'quill';
import { UppyFileData, UppyUploaderResponse, UppyUploaderService } from '../../../components/uppy-uploader/uppy-uploader.service';
enum ScrollPosition {
@@ -357,11 +358,14 @@ export class ChatRoomComponent implements OnInit, OnDestroy, AfterViewInit {
// Set aria-labels for Quill toolbar elements (WCAG 4.1.2)
setTimeout(() => {
- this.labelMessageEditor();
+ this._setQuillToolbarAriaLabels();
}, 500);
}
- labelMessageEditor(): void {
+ labelMessageEditor(editor: Quill): void {
+ editor.root.setAttribute('role', 'textbox');
+ editor.root.setAttribute('aria-multiline', 'true');
+ editor.root.setAttribute('aria-label', $localize`Enter your message`);
this._setQuillToolbarAriaLabels();
}
@@ -401,16 +405,6 @@ export class ChatRoomComponent implements OnInit, OnDestroy, AfterViewInit {
if (videoInput && !videoInput.getAttribute('aria-label')) {
videoInput.setAttribute('aria-label', 'Enter video embed URL');
}
-
- // Quill's contenteditable is not exposed as a named textbox unless these are set on .ql-editor.
- const messageEditor = componentElement.querySelector('.ql-editor') as HTMLElement;
- if (messageEditor) {
- messageEditor.setAttribute('role', 'textbox');
- messageEditor.setAttribute('aria-multiline', 'true');
- if (!messageEditor.getAttribute('aria-label')) {
- messageEditor.setAttribute('aria-label', $localize`Enter your message`);
- }
- }
}
/**
diff --git a/projects/v3/src/app/pages/home/home.page.html b/projects/v3/src/app/pages/home/home.page.html
index b178e026c..e21f86a12 100644
--- a/projects/v3/src/app/pages/home/home.page.html
+++ b/projects/v3/src/app/pages/home/home.page.html
@@ -156,23 +156,24 @@
}
- @switch (display) {
- @case ('activities') {
-
-
-
+
+ @if (display === 'activities') {
+
}
- @case ('badges') {
-
-
-
+
+
+ @if (display === 'badges') {
+
}
- @case ('pulse-checks') {
-
+
+ @if (pulseCheckIndicatorEnabled === true && !isExpertWithoutTeam) {
+
+ @if (display === 'pulse-checks') {
-
- }
+ }
+
}
+
diff --git a/projects/v3/src/app/pages/home/home.page.spec.ts b/projects/v3/src/app/pages/home/home.page.spec.ts
index a2598ffd5..51dde0b2d 100644
--- a/projects/v3/src/app/pages/home/home.page.spec.ts
+++ b/projects/v3/src/app/pages/home/home.page.spec.ts
@@ -487,4 +487,87 @@ describe('HomePage', () => {
});
});
+ describe('Ionic content tab accessibility', () => {
+ it('keeps Ionic segment controls and light DOM panel labels', () => {
+ const segment = fixture.nativeElement.querySelector('ion-segment');
+ expect(segment).not.toBeNull();
+ const tabs: HTMLElement[] = Array.from(fixture.nativeElement.querySelectorAll('ion-segment-button'));
+ expect(tabs.length).toBe(2);
+ tabs.forEach(tab => {
+ const panel = fixture.nativeElement.querySelector('#' + tab.getAttribute('aria-controls'));
+ expect(panel).not.toBeNull();
+ expect(panel?.getAttribute('aria-labelledby')).toBe(tab.id);
+ });
+ expect(fixture.nativeElement.querySelector('.content-tabs')).toBeNull();
+ });
+
+ it('switches content through Ionic ionChange and refreshes badge points', () => {
+ const segment = fixture.nativeElement.querySelector('ion-segment');
+ expect(segment).not.toBeNull();
+ if (!segment) { return; }
+ component.achievements = [];
+ (achievementService as any).isPointsConfigured = true;
+ (achievementService as any).earnedPoints = 12;
+ segment.dispatchEvent(new CustomEvent('ionChange', { detail: { value: 'badges' } }));
+ fixture.detectChanges();
+ expect(component.display).toBe('badges');
+ expect(component.getEarnedPoints).toBe(12);
+ expect(component.getIsPointsConfigured).toBeTrue();
+ expect(fixture.nativeElement.querySelector('#badges-panel').hidden).toBeFalse();
+ expect(fixture.nativeElement.querySelector('#activities-panel').hidden).toBeTrue();
+ });
+
+ describe('shadow DOM panel references', () => {
+ let host: HTMLIonColElement;
+ let tab: HTMLElement;
+ let native: HTMLButtonElement;
+ let panel: HTMLElement;
+
+ beforeEach(() => {
+ host = document.createElement('ion-col');
+ tab = document.createElement('ion-segment-button');
+ tab.setAttribute('aria-controls', 'review-panel');
+ native = document.createElement('button');
+ (tab.shadowRoot || tab.attachShadow({ mode: 'open' })).append(native);
+ panel = document.createElement('div');
+ panel.id = 'review-panel';
+ host.append(tab, panel);
+ document.body.append(host);
+ component.activityCol = { el: host };
+ });
+
+ afterEach(() => host.remove());
+
+ it('links the inner Ionic button to its light DOM panel by element reference', () => {
+ (component as any).linkContentTabs?.();
+ expect(Array.from(native.ariaControlsElements || [])).toEqual([panel]);
+ expect(native.getAttribute('aria-controls')).not.toBe('review-panel');
+ });
+
+ it('waits for Ionic hydration before linking a newly created button', async () => {
+ native.remove();
+ (tab as any).componentOnReady = () => Promise.resolve().then(() => {
+ tab.shadowRoot!.append(native);
+ return tab;
+ });
+ (component as any).linkContentTabs?.();
+ await Promise.resolve();
+ await Promise.resolve();
+ expect(Array.from(native.ariaControlsElements || [])).toEqual([panel]);
+ });
+
+ it('keeps older browsers free of invalid shadow DOM ID references', () => {
+ const descriptor = Object.getOwnPropertyDescriptor(Element.prototype, 'ariaControlsElements')!;
+ Reflect.deleteProperty(Element.prototype, 'ariaControlsElements');
+ try {
+ (component as any).linkContentTabs?.();
+ expect(native.hasAttribute('aria-controls')).toBeFalse();
+ expect(Object.hasOwn(native, 'ariaControlsElements')).toBeFalse();
+ expect(tab.getAttribute('aria-controls')).toBe('review-panel');
+ } finally {
+ Object.defineProperty(Element.prototype, 'ariaControlsElements', descriptor);
+ }
+ });
+ });
+ });
});
diff --git a/projects/v3/src/app/pages/home/home.page.ts b/projects/v3/src/app/pages/home/home.page.ts
index 026bd5dd0..abe8fafa1 100644
--- a/projects/v3/src/app/pages/home/home.page.ts
+++ b/projects/v3/src/app/pages/home/home.page.ts
@@ -76,6 +76,7 @@ export class HomePage implements OnInit, OnDestroy, AfterViewChecked {
activitySearchText = '';
filteredMilestones: Milestone[] | null = null;
private activityFilterLabelRequested = false;
+ private pendingContentTabs = new WeakSet();
// Expose Math to template
Math = Math;
@@ -135,7 +136,7 @@ export class HomePage implements OnInit, OnDestroy, AfterViewChecked {
return;
}
this.activityFilterLabelRequested = true;
- this.activityFilter.getInputElement().then((input) => {
+ Promise.resolve().then(() => this.activityFilter?.getInputElement?.()).then((input) => {
if (!input) {
this.activityFilterLabelRequested = false;
return;
@@ -147,23 +148,35 @@ export class HomePage implements OnInit, OnDestroy, AfterViewChecked {
}
/**
- * ion-segment-button already exposes an inner tab. Copy the panel relationship onto that tab.
- * The host id stays in light DOM so the tab panel aria-labelledby can still find it.
+ * ID references cannot cross Ionic's shadow boundary. Newer browsers can
+ * link the native tab directly to a light DOM panel through element references.
+ * Older browsers retain Ionic's tab semantics without an invalid shadow IDREF.
*/
private linkContentTabs(): void {
const host = this.activityCol?.el;
if (!host) {
return;
}
- host.querySelectorAll('ion-segment-button').forEach((button: Element) => {
- const segmentButton = button as HTMLElement;
- const native = segmentButton.shadowRoot?.querySelector('button');
- if (!native) {
- return;
- }
- const controls = segmentButton.getAttribute('aria-controls');
- if (controls && native.getAttribute('aria-controls') !== controls) {
- native.setAttribute('aria-controls', controls);
+ host.querySelectorAll('ion-segment-button').forEach(button => {
+ const linkPanel = () => {
+ const native = button.shadowRoot?.querySelector('button');
+ const controls = button.getAttribute('aria-controls');
+ const panel = controls ? host.querySelector(`#${controls}`) : null;
+ if (native && panel && 'ariaControlsElements' in native && native.ariaControlsElements?.[0] !== panel) {
+ native.ariaControlsElements = [panel];
+ }
+ };
+ if (button.shadowRoot?.querySelector('button')) {
+ linkPanel();
+ } else if (button.componentOnReady && !this.pendingContentTabs.has(button)) {
+ // A newly rendered Ionic element may hydrate after Angular checks the view.
+ this.pendingContentTabs.add(button);
+ button.componentOnReady().then(() => {
+ this.pendingContentTabs.delete(button);
+ if (host.isConnected) {
+ linkPanel();
+ }
+ }).catch(() => this.pendingContentTabs.delete(button));
}
});
}
diff --git a/projects/v3/src/app/services/experience.service.spec.ts b/projects/v3/src/app/services/experience.service.spec.ts
index a4bea7cf3..1d7d23cd0 100644
--- a/projects/v3/src/app/services/experience.service.spec.ts
+++ b/projects/v3/src/app/services/experience.service.spec.ts
@@ -89,7 +89,7 @@ describe('ExperienceService', () => {
expect(service).toBeTruthy();
});
- it('should initialise Pusher only after the selected experience is authenticated', async () => {
+ it('should authenticate the selected timeline before initialising Pusher', async () => {
const callOrder: string[] = [];
const sharedService = TestBed.inject(SharedService) as jasmine.SpyObj;
const authService = TestBed.inject(AuthService) as jasmine.SpyObj;
@@ -119,6 +119,10 @@ describe('ExperienceService', () => {
await service.switchProgramAndNavigate(experience as any);
+ expect(authService.authenticate).toHaveBeenCalledWith({
+ experienceUuid: 'experience-2',
+ timelineId: 222,
+ });
expect(callOrder).toEqual(['authenticate', 'pusher']);
expect(storageService.setUser).toHaveBeenCalledWith({ apikey: 'new-api-key' });
expect(sharedService.initWebServices).toHaveBeenCalledTimes(1);
diff --git a/projects/v3/src/app/services/experience.service.ts b/projects/v3/src/app/services/experience.service.ts
index 7a1807c08..72270e422 100644
--- a/projects/v3/src/app/services/experience.service.ts
+++ b/projects/v3/src/app/services/experience.service.ts
@@ -355,6 +355,7 @@ export class ExperienceService {
await this.switchProgram({ experience });
const authResponse = await firstValueFrom(this.authService.authenticate({
experienceUuid: experience.uuid,
+ timelineId: experience.timelineId,
}));
const apikey = authResponse?.data?.auth?.apikey;