Bug 238189 - AX: SpeechSynthesisUtterances queued immediately after speechSynthesis.cancel do not receive speech events
Summary: AX: SpeechSynthesisUtterances queued immediately after speechSynthesis.cancel...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Accessibility (show other bugs)
Version: Safari 15
Hardware: Mac (Apple Silicon) macOS 12
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-21 23:12 PDT by Martin Quiazon
Modified: 2022-03-21 23:12 PDT (History)
2 users (show)

See Also:


Attachments
HTML and JS demonstrating the bug (4.30 KB, text/html)
2022-03-21 23:12 PDT, Martin Quiazon
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Quiazon 2022-03-21 23:12:03 PDT
Created attachment 455338 [details]
HTML and JS demonstrating the bug

Summary:
When queueing a new utterance immediately after speechSynthesis.cancel(), the new utterance's onstart, onend, and onboundary event handlers do not trigger.

Overview:
Some applications require interrupting speech in progress and starting over with new utterances. Safari on macOS and Safari on iOS do not reliably trigger onstart, onend, and onboundary events on utterances that are queued up immediately following a speechSynthesis.cancel().

Steps to reproduce:

* Open the attached HTML file
* Click the Start Speaking button to begin speech
* While utterance is still in progress, click Interrupt button

Actual results, Safari 15.3 on a 14" MBP running macOS 12.2.1
* After clicking the Start Speaking button, the first sentence of the Gettysburg Address is spoken
* The speechDisplay DIV element is updated with the text "Started speaking."
* After clicking the Interrupt button, the in-progress sentence stops
* The speechDisplay DIV element is updated with the text "Error while speaking."
* The interruption text ("Well, that was rude...") is spoken.
* The speechDisplay DIV element is updated with the text "Error while interrupting."

Actual results, iOS 15.4 on iPhone SE (2020)
* After clicking the Start Speaking button, the first sentence of the Gettysburg Address is spoken
* The speechDisplay DIV element is updated with the text "Started speaking."
* After clicking the Interrupt button, the in-progress sentence stops
* The speechDisplay DIV element is updated with the text "Error while speaking."
* The interruption text ("Well, that was rude...") is spoken.
* The speechDisplay DIV element is updated with the text "Finished with the interruption."

Expected results:
* After clicking the Start Speaking button, the first sentence of the Gettysburg Address is spoken
* The speechDisplay DIV element is updated with the text "Started speaking."
* After clicking the Interrupt button, the in-progress sentence stops
* The speechDisplay DIV element is updated with the text "Error while speaking."
* The interruption text ("Well, that was rude...") is spoken.
* The speechDisplay DIV element is updated with the text "Interrupted!"
* The speech synthesizer finished speaking the interruption text.
* The speechDisplay DIV element is updated with the text "Finished with the interruption."

We still expect the onerror to be fired for the first utterance, as that is the usual WebKit behavior for canceling an utterance. But we would also expect the onstart handler for the second utterance to be triggered. And when the second utterance runs to completion, its onend handler should also trigger.

Additional Information:

Results when performing the same steps on the same 14" MBP with macOS 12.2.1 using Chrome, Edge, or Firefox:
* After clicking the Start Speaking button, the first sentence of the Gettysburg Address is spoken
* The speechDisplay DIV element is updated with the text "Started speaking."
* After clicking the Interrupt button, the in-progress sentence stops
* The speechDisplay DIV element is updated with the text "Finished speaking."
* The interruption text ("Well, that was rude...") is spoken.
* The speechDisplay DIV element is updated with the text "Interrupted!"
* The speech synthesizer finished speaking the interruption text.
* The speechDisplay DIV element is updated with the text "Finished with the interruption."

The main difference here is that when an utterance is canceled in other browser engines, the utterance receives an end event rather than an error.
Comment 1 Radar WebKit Bug Importer 2022-03-21 23:12:15 PDT
<rdar://problem/90615761>