Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions packages/url_launcher/url_launcher_web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## NEXT

* Ensure link widget merge its semantic node with its children to avoid duplicate nodes.

## 2.4.2

* Updates minimum supported SDK version to Flutter 3.29/Dart 3.7.

## 2.4.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,43 @@ void main() {
maxScrolls: 1000,
);
});

testWidgets('MergeSemantics is always present to avoid duplicate nodes', (
WidgetTester tester,
) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Column(
children: <Widget>[
WebLinkDelegate(
TestLinkInfo(
uri: Uri.parse('https://dart.dev/xyz'),
target: LinkTarget.blank,
builder: (BuildContext context, FollowLink? followLink) {
return ElevatedButton(
onPressed: followLink,
child: const Text('First Button'),
);
},
),
),
],
),
),
),
);

await tester.pumpAndSettle();

final Finder buttonFinder = find.byType(ElevatedButton);
expect(buttonFinder, findsOneWidget);

final Element buttonElement = tester.element(buttonFinder);
final MergeSemantics? parentWidget =
buttonElement.findAncestorWidgetOfExactType<MergeSemantics>();
expect(parentWidget, isNotNull);
});
});

group('Follows links', () {
Expand Down
16 changes: 9 additions & 7 deletions packages/url_launcher/url_launcher_web/lib/src/link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@ class WebLinkDelegateState extends State<WebLinkDelegate> {
}

Widget _buildChild(BuildContext context) {
return Semantics(
link: true,
identifier: _semanticsIdentifier,
linkUrl: widget.link.uri,
child: widget.link.builder(
context,
widget.link.isDisabled ? null : _followLink,
return MergeSemantics(
child: Semantics(
link: true,
identifier: _semanticsIdentifier,
linkUrl: widget.link.uri,
child: widget.link.builder(
context,
widget.link.isDisabled ? null : _followLink,
),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/url_launcher/url_launcher_web/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: url_launcher_web
description: Web platform implementation of url_launcher
repository: https://github.com/flutter/packages/tree/main/packages/url_launcher/url_launcher_web
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+url_launcher%22
version: 2.4.1
version: 2.4.2

environment:
sdk: ^3.7.0
Expand Down