From b527acba1c32d36c2894322b9e652b60f8db4906 Mon Sep 17 00:00:00 2001 From: Shawn Date: Tue, 23 Jan 2024 10:31:23 -0700 Subject: [PATCH] Use ExcludeFocus widget when IndexedStack child is not selected for better tab traversal with keyboard / screen reader. --- lib/ui/common/lazy_indexed_stack.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ui/common/lazy_indexed_stack.dart b/lib/ui/common/lazy_indexed_stack.dart index acc82e8e..8739da96 100644 --- a/lib/ui/common/lazy_indexed_stack.dart +++ b/lib/ui/common/lazy_indexed_stack.dart @@ -39,7 +39,9 @@ class LazyIndexedStackState extends State { // Mark current index as active _activated[widget.index] = true; final children = List.generate(_activated.length, (i) { - return _activated[i] ? widget.children[i] : const SizedBox.shrink(); + Widget child = _activated[i] ? widget.children[i] : const SizedBox.shrink(); + bool isSelected = widget.index == i; + return ExcludeFocus(excluding: !isSelected, child: child); }); return IndexedStack( alignment: widget.alignment,