fix: defer autoplay until translation is complete to address UI deadlock#659
Open
thiago-lopes-dev wants to merge 3 commits intomicrosoft:devfrom
Open
fix: defer autoplay until translation is complete to address UI deadlock#659thiago-lopes-dev wants to merge 3 commits intomicrosoft:devfrom
thiago-lopes-dev wants to merge 3 commits intomicrosoft:devfrom
Conversation
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
Author
|
closes #483 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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