Send button: keep its 'Send' name for assistive technology when usage is shown
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1309,17 +1309,26 @@ class _ChatComposerBarState extends State<ChatComposerBar> {
|
||||
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),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user