Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
base
  • Loading branch information
pedromassango committed May 20, 2025
commit 06d560df06e8eba0a7ba3cd0f2827c707b5f2ffa
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'dart:typed_data';
import 'dart:ui_web' as ui_web;

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:url_launcher_platform_interface/link.dart';
Expand Down Expand Up @@ -181,6 +182,52 @@ void main() {
maxScrolls: 1000,
);
});

testWidgets('Link widget TAB traversal - expected behavior',
(WidgetTester tester) async {
// Pump the app
await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: FocusScope(
autofocus: true,
child: Row(
children: [
WebLinkDelegate(TestLinkInfo(
uri: null,
target: LinkTarget.defaultTarget,
builder: (BuildContext context, FollowLink? followLink) {
return ElevatedButton(
onPressed: () {}, child: const Text('First'));
},
)),
WebLinkDelegate(TestLinkInfo(
uri: null,
target: LinkTarget.defaultTarget,
builder: (BuildContext context, FollowLink? followLink) {
return ElevatedButton(
onPressed: () {}, child: const Text('Second'));
},
)),
],
),
),
));

// Wait for rendering
await tester.pumpAndSettle();

// Send two TAB key presses
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.pump();
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.pump();

// Find the second button
final secondButton = find.widgetWithText(ElevatedButton, 'Second');
final focusNode = Focus.of(tester.element(secondButton));

expect(focusNode.hasFocus, isTrue);
});
});

group('Follows links', () {
Expand Down