Skip to content

fix: make getEventContext() work with context-menu on iOS - #4004

Merged
web-padawan merged 3 commits into
masterfrom
fix/context-menu-path
Jun 8, 2022
Merged

web-padawan merged 3 commits into
masterfrom
fix/context-menu-path

Conversation

@web-padawan

Copy link
Copy Markdown
Member

Description

This PR addresses a problem that makes grid.getEventContext() broken when using vaadin-contextmenu event.
Note, this logic is quite fundamental for vaadin-grid context-menu feature, as you can see it's used in two places:

The actual problem is that event.composedPath() returns [] (empty array) as soon as you use setTimeout().
This is exactly what we are doing for touchstart event by setting timer in our contextmenu gesture.

Fixes vaadin/flow-components#3296
Fixes vaadin/flow-components#2951

Note: this needs an integration test, I'd like to add it in a separate PR to make cherry-picking easier.

Also note, the unit test that I added covers contextmenu event and not touchstart.
We do not currently run tests on iOS, so corresponding test suite is skipped 😕

Type of change

  • Bugfix

@web-padawan web-padawan changed the title fix: preserve composedPath() for the source event fix: make getEventContext() work with context-menu on iOS Jun 8, 2022
@sonarqubecloud

sonarqubecloud Bot commented Jun 8, 2022

Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@vaadin-bot

Copy link
Copy Markdown
Collaborator

Hi @web-padawan , this commit cannot be picked to 22.0 by this bot, can you take a look and pick it manually?
Error Message: Error: Command failed: git cherry-pick e0be5ce
error: could not apply e0be5ce... fix: make getEventContext() work with context-menu on iOS (#4004)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

web-padawan added a commit that referenced this pull request Jun 8, 2022
)

Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grid context menu not working on iOS in Vaadin 23 [context-menu] ContextMenu TS example is broken on iOS using Vaadin 23

3 participants