From 22550b34039e5ba38261ce5061977ef091b14899 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Mon, 30 Nov 2026 15:06:22 +0000 Subject: [PATCH] Send button: keep its 'Send' name for assistive technology when usage is shown Co-Authored-By: Claude Opus 5.5 --- .../chat/conversation/chat_composer_bar.dart | 31 ++++++++++++------- .../chat_send_usage_ring_test.dart | 2 ++ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/app/lib/features/chat/conversation/chat_composer_bar.dart b/app/lib/features/chat/conversation/chat_composer_bar.dart index 5fcbaffc..dbedaa07 100644 --- a/app/lib/features/chat/conversation/chat_composer_bar.dart +++ b/app/lib/features/chat/conversation/chat_composer_bar.dart @@ -1309,17 +1309,26 @@ class _ChatComposerBarState extends State { source: usage, usage: () => usage?.accountUsage, label: label, - button: (tooltip) => IconButton.filled( - key: const Key('chat-composer-primary'), - tooltip: tooltip, - style: tinted == null - ? null - : IconButton.styleFrom( - backgroundColor: tinted.primary, - foregroundColor: tinted.onPrimary, - ), - onPressed: enabled ? press : null, - icon: const Icon(Icons.arrow_upward), + // One shape with or without usage (a report never remounts the + // button): the hover text can grow with usage, while assistive + // technology still names the button by its label alone. + button: (tooltip) => Semantics( + label: label, + child: Tooltip( + message: tooltip, + excludeFromSemantics: true, + child: IconButton.filled( + key: const Key('chat-composer-primary'), + style: tinted == null + ? null + : IconButton.styleFrom( + backgroundColor: tinted.primary, + foregroundColor: tinted.onPrimary, + ), + onPressed: enabled ? press : null, + icon: const Icon(Icons.arrow_upward), + ), + ), ), ); } diff --git a/app/test/features/chat/conversation/chat_send_usage_ring_test.dart b/app/test/features/chat/conversation/chat_send_usage_ring_test.dart index 4bb95536..7cd088e7 100644 --- a/app/test/features/chat/conversation/chat_send_usage_ring_test.dart +++ b/app/test/features/chat/conversation/chat_send_usage_ring_test.dart @@ -98,6 +98,8 @@ void main() { expect(tooltip, contains(' · Weekly 61% · resets ')); // The button is still the same element: a report never remounts it. expect(find.byType(IconButton), findsWidgets); + // Assistive technology still names it by its label alone. + expect(find.bySemanticsLabel('Send'), findsOneWidget); }); testWidgets('long-press shows the usage tooltip on touch', (tester) async {