duckduckgo / zeroclickinfo-goodies

DuckDuckGo Instant Answers based on Perl & JavaScript

Home Page:https://duckduckhack.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timer: Timer doesn't ring when tab is inactive

x-15a2 opened this issue · comments

When a timer is running in DDG and the user goes to another browser tab, the timer doesn't ring when complete. The timer only sends an alter if the tab is active.


IA Page: http://duck.co/ia/view/timer
Maintainer: @mattr555

Thanks for reporting @x-15a2. I'm unable to recreate this in FF/Brave/Google on Mac.

I suspect it's actually the fact that the audio is blocked by default if the user hasn't clicked at all on the page, regardless of whether the tab has focus.

If from the url bar, or SERP you search "timer 1s" and switch tabs (or not), you shouldn't hear audio because the users hasn't clicked the page.

If they start the timer manually by clicking the play button, regardless of tab activity, they should be able to hear the sound. The same applies to Google in my testing.

I think the only solution would be to force the user to press the play button to start the timer.

I've noticed this myself on FF + Windows 10 and found basically the same thing as you predicted @moollaza

If I search from http://ddg.gg myself, the sound will play; however straight from the search bar, it won't unless I interact with the page somehow

Agreed, it seems that it's a page focus issue. Seems odd, but I've verified it using Vivaldi and FF. I'll post this in the DDG subReddit.

Thanks for checking this out and for the info.

On Microsoft Edge, I can search from https://duckduckgo.com/, click all over the page while the timer is running, then switch to a different tab, and the sound still does not play.

The timer should be removed if it's not going to ring when time elapses. Starting a timer to keep track of e.g. cooking food, then switching tabs to do other things while one's waiting for the time to elapse, is an extremely sensible use case for a timer. If I wanted to stare at the timer while it's counting down, I'd just stare at the cooking food instead.