feat(event-form): auto-focus the title on a new event, optionally (#10)
Opening the new-event form now puts the cursor in the title field and raises the keyboard, so the user can type the name straight away instead of tapping the field first (issue #10). On by default — most events get a title — with a new "Focus title on new event" switch in Settings → New event form to turn it off. Only the create form auto-focuses: editing an existing event and opening a prefilled/imported form never grab focus (guarded by !isEditing && title blank). - SettingsPrefs: autofocusEventTitle (booleanPreferencesKey), default true. - Plumbed through SettingsViewModel/UiState (settings switch) and EventEditViewModel/UiState (read by the form). - EventEditScreen: a FocusRequester on the title InlineField, requested once per open from a LaunchedEffect when the guard holds. - Strings (en + de), unit test for the new pref default/round-trip. Bumps to 2.11.2. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -90,6 +90,14 @@ class SettingsPrefsTest {
|
||||
assertThat(prefs.showHourLines.first()).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `autofocus event title defaults on and round-trips`(@TempDir tempDir: Path) = runTest {
|
||||
val prefs = SettingsPrefs(newDataStore(tempDir))
|
||||
assertThat(prefs.autofocusEventTitle.first()).isTrue()
|
||||
prefs.setAutofocusEventTitle(false)
|
||||
assertThat(prefs.autofocusEventTitle.first()).isFalse()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `agenda ranges default to month and round-trip independently`(@TempDir tempDir: Path) = runTest {
|
||||
val prefs = SettingsPrefs(newDataStore(tempDir))
|
||||
|
||||
Reference in New Issue
Block a user