Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add global click handler for navigation #20990

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mcollovati
Copy link
Collaborator

When using React router, clicks on anchors are intercepted only if Flow client has been initialized. In Hilla or hybrid application, if a Flow view is never navigated, clicking on such links cause the browser to reload the page instead of navigating to the expected view.
This change registers a global click handler that intercepts click events and triggers a router navigation if necessary.
The new behavior is aligned with vaadin-router.

Fixes #20939

Copy link

github-actions bot commented Feb 12, 2025

Test Results

1 169 files  ±0  1 169 suites  ±0   1h 15m 32s ⏱️ - 1m 53s
7 776 tests ±0  7 719 ✅ ±0  57 💤 ±0  0 ❌ ±0 
8 137 runs   - 3  8 071 ✅  - 3  66 💤 ±0  0 ❌ ±0 

Results for commit 0613bab. ± Comparison against base commit 8e2248c.

♻️ This comment has been updated with latest results.

When using React router, clicks on anchors are intercepted only if Flow client
has been initialized. In Hilla or hybrid application, if a Flow view is never
navigated, clicking on such links cause the browser to reload the page instead
of navigating to the expected view.
This change registers a global click handler that intercepts click events and
triggers a router navigation if necessary.
The new behavior is aligned with vaadin-router.

Fixes #20939
@mcollovati mcollovati force-pushed the issues/20939-react_router_intercept_anchore_clicks branch from dae52c7 to 8601543 Compare February 13, 2025 09:21
@vaadin-bot vaadin-bot added +1.0.0 and removed +0.0.1 labels Feb 13, 2025
@vaadin-bot vaadin-bot added +0.0.1 and removed +1.0.0 labels Feb 14, 2025
@mshabarov mshabarov self-requested a review February 17, 2025 12:34
@mshabarov mshabarov requested review from tepi and removed request for mshabarov March 3, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Router throws exception when navigating between PermitAll and AnonymousAllowed views
3 participants