flutter_html
flutter_html copied to clipboard
[BUG] onLinkTap not working on class element with Display.BLOCK Style
Describe the bug:
Links with specific class element need to have their own style and be clickable. If we apply a Display.BLOCK on the class element the onLinkTap will not be triggered as it should in default Html behavior.
HTML to reproduce the issue:
Html(
data: '<p><a href="https://www.google.fr" target="_blank" rel="noopener">OK - onLinkTap triggered</a></p><p><a class="btn-buy aligncenter" href="https://www.yahoo.fr" target="_blank" rel="noopener">KO - onLinkTap will not be triggered</a></p>',
onLinkTap: (String? url, RenderContext context1, Map<String, String> attributes, _) {
print('onLinkTap : $url');
},
style: {
"a": Style(color: Colors.black),
"a.btn-buy": Style( textDecoration: TextDecoration.none),
".btn-buy": Style(
display: Display.BLOCK,
color: Colors.white,
backgroundColor: Colors.black
)
}
)
Html widget configuration:
Expected behavior:
Class element with Display.BLOCK should trigger onLinkTap without the need of customRender
Device details and Flutter/Dart/flutter_html versions:
flutter_html: ^2.2.0