[url_launcher]: (Web) When click on Link widget without calling followLink function still takes browser to that link#8588
Conversation
…n still takes browser to that link
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
This would break a lot of usage of Given that, this is not a change we would take. The next step here is to understand the use case in the issue, so that we can see if there is a way to address that use case without breaking common |
|
Ok, what about i create a property like 'preventDefault', and if its true then i add event. preventDefault() in |
|
I think @mdebbar fixed this one recently: |
Bug
If you wrap a ElevatedButton with Link widget on web, and don't pass followLink function to ElevatedButton, when you click on that ElevatedButton button, it still takes user to that link.
Sample Code
The issue was happening because
Linkwidget is creating below element on web:Even when i am not passing
followLinktoonPressed, it still opens google in new tab.Fix
We need to pass
onclick="event.preventDefault();"toahtml element so that it won't open link on it own.This is how it looks after the fix:
Pre-launch Checklist
dart format.)[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or this PR is exempt from CHANGELOG changes.///).