Skip to content

[a11y-base] Move long touch gesture from context-menu to the base package #5681

@web-padawan

Description

@web-padawan

Describe your motivation

Because of historical reasons, vaadin-context-menu registers a Polymer gesture handler to deal with iOS:

this._timerId = setTimeout(() => {
const ct = e.changedTouches[0];
if (!e.shiftKey) {
if (isIOS) {
this._fired = true;
this.fire(t, ct.clientX, ct.clientY);
}
// Needed to prevent any 'tap' gesture events from firing
// which could potentially cancel/close the overlay.
prevent('tap');
}
}, 500); // Default setting for Android and iOS.
},

We might want to re-use this logic with other components e.g. vaadin-tooltip on mobile or something else.

Describe the solution you'd like

  1. Move vaadin-contextmenu-event.js file to @vaadin/a11y-base package,
  2. Try to improve test coverage, even though we don't test on iOS Simulator,
  3. Check out React Aria's useLongPress hook implementation for more ideas.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions