Quicktime object grabs input when calling Sound.play()
Reported by Elia Schito | August 19th, 2008 @ 05:34 PM
In Firefox (not sure about IE) if an asynchronous event starts a sound (e.g. an alarm) the keyboard input will be grabbed by the Quicktime object from the whole browser.
Clicking again on the same input field you are typing doesn't help, the only way to get the input back in the browser is to click somewhere else and then again in the input field.
I've already tried (without success) to cache the last active element (window.document.activeElement) and recall focus() on it. Now I'm trying variants that includes caching of the activeElement and a delayed attempt of moving out and in the focus from it...
UPDATE:
Add what follows to Sound.play() to avoid the problem (does not always work, to be tested):
play: function(url){
// Cache the current active element for later restoring
Sound._lastActiveElement = window.document.activeElement;
// ...
if (Prototype.Browser.Gecko) {
// Blur the Quicktime object and focus the cached active element
$$('body embed, body object').first().blur();
Sound._lastActiveElement.focus();
Sound._lastActiveElement = null;
};
},
stop: function(url){
// ...
Comments and changes to this ticket
-
Elia Schito August 21st, 2008 @ 05:22 PM
Below one of my attempts on working-around this problem, perhaps' a good hint.
To be added at the end of Sound.play()
@@@javascript
if (Prototype.Browser.Gecko) { // Blur the Quicktime object and focus the cached active element $$('body embed, body object').first().blur(); Sound._lastActiveElement.focus(); Sound._lastActiveElement = null; }; -
Elia Schito August 21st, 2008 @ 05:22 PM
- → Tag changed from scriptaculous sound to "firefox 3" scriptaculous sound
Below one of my attempts on working-around this problem, perhaps' a good hint.
To be added at the end of Sound.play()
@@@javascript
if (Prototype.Browser.Gecko) { // Blur the Quicktime object and focus the cached active element $$('body embed, body object').first().blur(); Sound._lastActiveElement.focus(); Sound._lastActiveElement = null; };
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
script.aculo.us is an open-source JavaScript framework for visual effects and interface behaviours.
Source available from github
The Git repository resides at:
http://github.com/madrobby/scriptaculous
Check out the current development trunk with:
git clone git://github.com/madrobby/scriptaculous.git
As script.aculo.us 1.xx is feature-frozen, this development trunk is for bugfixes only.
New development should happen only for
script.aculo.us 2.
Creating a bug report
When creating a bug report, be sure to include as much relevant information as possible. Post a an example that shows off the problem. Preferably, alter the unit tests and show through either changed or added tests how the expected behavior is not occuring.
