Page MenuHomePhabricator

Wikispeech.playOrStop() triggers twice if button is in focus
Closed, ResolvedPublic0.5 Estimated Story Points

Description

If the play/stop button is selected and ctrl + space (default shortcut) is pressed, first Wikispeech.playOrStop() is triggered, then the button click event fires, triggering playOnStop() again. The result is that the player starts playing after stopping and stops after starting.

The behaviour may changed, if for example a media player GUI is used. If not, stopping the event from bubbling should solve this: http://api.jquery.com/event.stopPropagation/. event.preventDefault() is probably what we want.

Event Timeline

The event that triggers the click seems to be keyup and not keydown.

Lokal_Profil moved this task from Backlog to Incoming on the Wikispeech board.
Lokal_Profil moved this task from Backlog to Technical debt on the Wikispeech-WMSE board.
Lokal_Profil set the point value for this task to 1.Nov 30 2016, 2:05 PM
Sebastian_Berlin-WMSE changed the point value for this task from 1 to 4.Feb 7 2017, 2:43 PM

Changed story points to new system

Turns out that it's keyup that triggers button clicks. Catching these events when space is in a short cut should do the trick.

Change 343026 had a related patch set uploaded (by Sebastian Berlin (WMSE)):
[mediawiki/extensions/Wikispeech] Prevent keyboard shortcuts from triggering buttons.

https://gerrit.wikimedia.org/r/343026

Mental note to also update documentation with the new shortcuts.

Sebastian_Berlin-WMSE changed the point value for this task from 4 to 0.5.

Worked on in Wikispeech (Sprint 2017-03-08):

  • Implemented.
  • First review,

To do in Wikispeech (Sprint 2017-03-22):

  • Finish review.

Change 343026 merged by jenkins-bot:
[mediawiki/extensions/Wikispeech@master] Prevent keyboard shortcuts from triggering buttons.

https://gerrit.wikimedia.org/r/343026

Mentioned in SAL (#wikimedia-labs) [2017-03-23T12:33:40Z] <Sebastian-WMSE> Deploy latest from Git master: e41c0c2 (T146459, T158954)