Chrome AI Summarizer User Activation Handling #14292
Open
+82
−49
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.
Type of change
Description of change
Fixed : #14284
This PR addresses an issue where the Chrome AI Summarizer API initialization would fail with a NotAllowedError if the model required downloading and the page load occurred without a user gesture (sticky activation).
When Summarizer.availability() returns a status indicating a download is needed (e.g., 'after-download'), the browser prevents the download from starting unless a user gesture is present.
This change implements a robust check:
This ensures the module does not error out silently or noisily on page load and properly initializes once the user interacts with the page, complying with valid sticky activation requirements.
Reference Links:
https://developer.chrome.com/docs/ai/get-started#user-activation
https://developer.mozilla.org/en-US/docs/Glossary/Sticky_activation
Other information