Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add click handler to links that prevents default
  • Loading branch information
johnsonmh authored Jan 23, 2024
commit ce9d21ad71aba4496e23efecac4d2b748a54d280
6 changes: 6 additions & 0 deletions lib/web_ui/lib/src/engine/semantics/link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ class Link extends PrimaryRoleManager {
// https://github.com/flutter/flutter/issues/102535.
element.setAttribute('href', '#');
element.style.display = 'block';
// Prevent the default action of clicking the anchor tag, which is to
// navigate to the href. Instead the click action is handled by the
// framework.
element.addEventListener('click', createDomEventListener((DomEvent event) {
event.preventDefault();
}));
return element;
}

Expand Down