diff --git a/src/app/plugins/call/CallControl.ts b/src/app/plugins/call/CallControl.ts index 145283898..8732648dc 100644 --- a/src/app/plugins/call/CallControl.ts +++ b/src/app/plugins/call/CallControl.ts @@ -29,17 +29,13 @@ export class CallControl extends EventEmitter implements CallControlState { } private get settingsButton(): HTMLElement | undefined { - const leaveBtn = this.document?.querySelector('[data-testid="incall_leave"]'); - - const settingsButton = leaveBtn?.previousElementSibling as HTMLElement | null; - - return settingsButton ?? undefined; + // EC 0.19.3: settings button has data-testid="settings-bottom-center" + return (this.document?.querySelector('[data-testid="settings-bottom-center"]') as HTMLElement) ?? undefined; } private get reactionsButton(): HTMLElement | undefined { - const reactionsButton = this.settingsButton?.previousElementSibling as HTMLElement | null; - - return reactionsButton ?? undefined; + // EC 0.19.3: reactions/raise-hand button has a CSS module class containing "raiseHand" + return (this.document?.querySelector('[class*="raiseHand"]') as HTMLElement) ?? undefined; } private get spotlightButton(): HTMLInputElement | undefined { @@ -165,6 +161,8 @@ export class CallControl extends EventEmitter implements CallControlState { } public onControlMutation() { + const prevScreenshare = this.screenshare; + const screenshare: boolean = this.screenshareButton?.getAttribute('data-kind') === 'primary'; const spotlight: boolean = this.spotlightButton?.checked ?? false; @@ -176,6 +174,11 @@ export class CallControl extends EventEmitter implements CallControlState { spotlight ); this.emitStateUpdate(); + + // EC auto-switches to spotlight when screenshare starts — revert to grid + if (!prevScreenshare && screenshare) { + setTimeout(() => { if (this.spotlight) this.gridButton?.click(); }, 600); + } } public setMicrophone(enabled: boolean) {