diff --git a/CHANGELOG.md b/CHANGELOG.md index 1aec332..3c913cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.10.1 + +- **FEAT**: Multi screen forms now auto-focus `Next` button on the summary screen to prioritise form submission. + ## 0.10.0 - **BREAKING**: `ServerpodTerminalBackend`'s `preExit` now requires `exitCode`. diff --git a/lib/src/form/state.dart b/lib/src/form/state.dart index 7fde8e0..acc6e4a 100644 --- a/lib/src/form/state.dart +++ b/lib/src/form/state.dart @@ -396,8 +396,8 @@ class MultiScreenFormState extends FormState { updateFocusedConfigOption(-currentFocus); } } else { - // Focus action buttons on summary screen. - focusDown(); + // Focus action button on summary screen. + focusNextButton(); } } } diff --git a/pubspec.yaml b/pubspec.yaml index f68e46a..cd3662f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: serverpod_tui description: A collection of tools for building terminal user interfaces. -version: 0.10.0 +version: 0.10.1 repository: https://github.com/serverpod/serverpod_tui homepage: https://serverpod.dev issue_tracker: https://github.com/serverpod/serverpod_tui/issues diff --git a/test/form/multi_screen_test.dart b/test/form/multi_screen_test.dart index f96f975..fafe705 100644 --- a/test/form/multi_screen_test.dart +++ b/test/form/multi_screen_test.dart @@ -318,7 +318,7 @@ void main() { test( 'when navigating through all screens, ' - 'then the summary screen is reached', + 'then the summary screen is reached and the Next button is focused', () async { final configCount = state.configScreenCount; @@ -331,6 +331,7 @@ void main() { expect(state.isSummary, isTrue); expect(state.currentScreenIndex, configCount); + expect(state.focusedButtonIndex, 1); }, ); @@ -347,6 +348,7 @@ void main() { // Focus on buttons await _sendKey(tester, LogicalKey.arrowDown); + await _sendKey(tester, LogicalKey.arrowLeft); await _pump(tester); // Space to press back button