Sub6Resources / flutter_html

A Flutter widget for rendering static html as Flutter widgets (Will render over 80 different html tags!)
https://pub.dev/packages/flutter_html
MIT License
1.8k stars 874 forks source link

[BUG] onLinkTap does not work in case <a> tag does not have a `href` property #1132

Closed vladimir-beloded closed 2 years ago

vladimir-beloded commented 2 years ago

Describe the bug: The onLinkTap callback is not called when the HTML string contains the <a> tab, but this tag does not contain the href

HTML to reproduce the issue: Here is a sample HTML to reproduce this issue:

<p>This is a text <a>This is a link</a></p>

Html widget configuration: The HTML widget configuration looks like the following:

            Html(
              data:
                  '<p>This is a text <a>This is a link</a></p>',
              onLinkTap: (_, __, ___, ____) => print('123'),
            )

Expected behavior: I'd expect that on tap on This is a link text, the 123 should be printed into the console.

Additional info: flutter_html version is 3.0.0-alpha.5

A picture of a cute animal (not mandatory but encouraged)

image

Sub6Resources commented 2 years ago

Thanks for the report! This feature was actually removed in #1092 since it didn't align with the w3c standards for how the a tag should function. If there is no href, then the link becomes unclickable. This can be overridden using customRender if you'd like a custom solution.