From 1460b5f3498bfc6941487535ed84559dd4a0a3a3 Mon Sep 17 00:00:00 2001 From: Nickhasntlost Date: Sat, 31 Oct 2026 22:03:55 +0530 Subject: [PATCH] content: Underline links in messages for accessibility Links were previously distinguished only by color, which fails WCAG F73 and is inconsistent with the web app's link styling. Add an underline matching the existing pattern in text.dart. Fixes #2512 --- lib/widgets/content.dart | 5 ++++- test/widgets/content_test.dart | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/widgets/content.dart b/lib/widgets/content.dart index eb91d3811..6a22e31fe 100644 --- a/lib/widgets/content.dart +++ b/lib/widgets/content.dart @@ -1140,7 +1140,10 @@ class _InlineContentBuilder { assert(recognizer != null); _pushRecognizer(recognizer); final result = _buildNodes(node.nodes, - style: TextStyle(color: ContentTheme.of(_context!).colorLink)); + style: TextStyle( + color: ContentTheme.of(_context!).colorLink, + decoration: TextDecoration.underline, + decorationColor: ContentTheme.of(_context!).colorLink)); _popRecognizer(); return result; diff --git a/test/widgets/content_test.dart b/test/widgets/content_test.dart index 0f85c0ac3..916726f03 100644 --- a/test/widgets/content_test.dart +++ b/test/widgets/content_test.dart @@ -1426,6 +1426,16 @@ void main() { .single.equals((url: Uri.parse('file:///etc/bad'), mode: LaunchMode.platformDefault)); checkErrorDialog(tester, expectedTitle: 'Unable to open link'); }); + + testWidgets('link is underlined', (tester) async { + await prepare(tester, '

hello

'); + + final richText = tester.widget(find.text('hello', findRichText: true)); + final style = mergeSpanStylesOuterToInner(richText.text, + (span) => span is TextSpan && span.text == 'hello'); + + check(style!.decoration).equals(TextDecoration.underline); + }, variant: const TargetPlatformVariant({TargetPlatform.android, TargetPlatform.iOS})); }); group('LinkNode on internal links', () {