Skip to content

All JQuery click events are unbind on init of speech description #575

@Tim-Obert

Description

@Tim-Obert

When initializing in description.js, all clickevents on document are removed instead of only the newly added one.
Specifically, this causes a problem with "collapse" in Bootstrap v4. Here it also listens to click on the document, which doesn't work after this function removes all click eventlistener on document. Line 198:

if (context === 'init') {
// handle a click on anything, in case the user
// clicks something before they click 'play' or 'prefs' buttons
// that would allow us to init speech before it's needed
$(document).on('click',function() {
var greeting = new SpeechSynthesisUtterance('Hi!');
greeting.volume = 0; // silent
greeting.rate = 10; // fastest speed supported by the API
thisObj.synth.speak(greeting);
greeting.onstart = function(e) {
// utterance has started
$(document).off('click'); // unbind the click event listener
}
greeting.onend = function(e) {
// should now be able to get browser voices
// in browsers that require a click
thisObj.getBrowserVoices();
if (thisObj.descVoices.length) {
thisObj.speechEnabled = true;
}
};
});

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions