Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what constitues user gesture

I recently programmed a menu interface for javascript that lets you dynamically add options to it and mostly works with mouseEnter Events . I thne added some basic video Controls to it with request/exit Fullscreen that trigger on one of these mouseEnter events most of the time it displays Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture. however (weird part :) sometimes it works and im not sure how the browser api decides wether an action is a user gesture or not oO any help would be appreciated thanks

like image 694
jonathan Heindl Avatar asked May 31 '19 03:05

jonathan Heindl


People also ask

What is user gesture promise?

edited. Chromium has a notion of a "user gesture" which indicates that we believe the user is explicitly interacting with the page (eg. mouse click, but not mouse move or wheel). Then certain sensitive operations are restricted to apply only if it can "consume" a user gesture (eg. one successful window.

Can only be initiated by a user gesture?

You may get this error if you are trying to have the player execute an action without it being initiated by the user. A typical example is going fullscreen or automatically starting playback (often on mobile).


1 Answers

Here is the list of events that can trigger "by user activation" as defined by the specs:

  • change
  • click
  • contextmenu
  • dblclick
  • mouseup
  • pointerup
  • reset
  • submit
  • touchend

This is what your error message refers to when they say "a user gesture".

mouseenter is not part of this list.

Most likely, when it worked, it was because one of those event did happen less than a few ms before (IIRC it's 50ms in Chrome currently).

like image 193
Kaiido Avatar answered Sep 22 '22 18:09

Kaiido