Skip to content

fix: defer autoplay until translation is complete to address UI deadlock#659

Open
thiago-lopes-dev wants to merge 3 commits intomicrosoft:devfrom
thiago-lopes-dev:dev
Open

fix: defer autoplay until translation is complete to address UI deadlock#659
thiago-lopes-dev wants to merge 3 commits intomicrosoft:devfrom
thiago-lopes-dev:dev

Conversation

@thiago-lopes-dev
Copy link
Copy Markdown

Description
This PR resolves a race condition where the Immersive Reader would hang (infinite spinner) when both readAloudOptions.autoplay and translationOptions.autoEnableDocumentTranslation were enabled.

The issue occurred because the Text-to-Speech engine attempted to play content before the translation engine finished re-rendering the document's DOM nodes.

Changes
Modified launchAsync.ts: Updated the messageHandler to intercept the initial Content message.

Logic update: If auto-translation is active, the autoplay flag is now temporarily set to false in the initial payload to prevent the deadlock.

New Event Listener: Added a listener for the ImmersiveReader-TranslationComplete message, which now triggers a manual Play command once the translated content is ready.

Related Issues
Fixes #522

@thiago-lopes-dev
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

…recalculation

Overview
This PR addresses a recurring TypeError: Cannot read properties of undefined (reading 'height') that occurs in the Immersive Reader's internal virtualized content pane, specifically when processing long HTML chunks.

The Problem
In certain viewports and with specific HTML structures (like multiple <p> tags), the internal React virtualized list fails to calculate the height of a token/element before the SDK attempts to scroll it into view. This causes the reader to "hang" and stops the Read Aloud functionality, as reported in Issue microsoft#483

clsoses microsoft#483
@thiago-lopes-dev
Copy link
Copy Markdown
Author

closes #483

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reader hangs when autoPlay and autoTranslation are both activated

1 participant