Skip to content
Merged
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
1 change: 1 addition & 0 deletions packages/dropdown_button2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Implement switch expressions.
- Fix memory leak in CurvedAnimation [Flutter core].
- Avoid Container objects when possible for better performance [Flutter core].
- Add semantics to dropdown menu items [Flutter core].

## 3.0.0-beta.21

Expand Down
4 changes: 3 additions & 1 deletion packages/dropdown_button2/lib/src/dropdown_button2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -882,8 +882,10 @@ class _DropdownButton2State<T> extends State<DropdownButton2<T>>
);
}

final bool childHasButtonSemantic = hintIndex != null ||
(_selectedIndex != null && widget.selectedItemBuilder == null);
return Semantics(
button: true,
button: !childHasButtonSemantic,
child: Actions(
actions: _actionMap,
child: InkWell(
Expand Down
9 changes: 6 additions & 3 deletions packages/dropdown_button2/lib/src/dropdown_menu_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,12 @@ class _DropdownMenuItemContainer extends StatelessWidget {

@override
Widget build(BuildContext context) {
return SizedBox(
height: intrinsicHeight ? null : height,
child: Align(alignment: alignment, child: child),
return Semantics(
button: true,
child: SizedBox(
height: intrinsicHeight ? null : height,
child: Align(alignment: alignment, child: child),
),
);
}
}
Expand Down