Skip to content

[BUG] <a> tag must not show underline or decoration when no href #931

@ghost

Description

Describe the bug:

The a tag must not show underline or any decoration when link (href) is not present.

HTML to reproduce the issue:

<html>
<body>
<br/>
<a>test 1</a>
<br/>
<a href="">test 2</a>
<br/>
<a href="/test">test 3</a>

</p>
</body>
</html>

Current output :
Capture d’écran 2021-12-09 à 10 26 15

Html widget configuration:

 @override
  Widget build(BuildContext context) {
    return Html(
      data: html,
      onAnchorTap: (String? url, RenderContext context, Map<String, String> attributes, dynamic element) {
        if (url == null) return;
        openLink(url);
      },
      onLinkTap: (String? url, RenderContext context, Map<String, String> attributes, dynamic element) {
        if (url == null) return;
        openLink(url);
      },
    );
  }

Expected behavior:

Capture d’écran 2021-12-09 à 10 25 16

Screenshots:

Device details and Flutter/Dart/flutter_html versions:

flutter_html: 2.2.1
Flutter version 2.5.3
Testing on Flutter web Chrome
Chrome (web) • chrome • web-javascript • Google Chrome 96.0.4664.55

Stacktrace/Logcat

Additional info:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions