[Bug]: Opening Touchpad/Keyboard Settings momentarily collapses overlay and flashes MacroPad Home screen
Description
When the user is in Fullscreen Touchpad (_uiMode = TOUCHPAD) or Fullscreen Keyboard (_uiMode = KEYBOARD) mode and taps the top-right Settings gear icon, the overlay unexpectedly begins a ~250ms slide-down exit animation (slideOutVertically). This momentarily exposes the underlying MacroPad Home screen before the Settings modal overlay appears.
When closing the Settings dialog, the reverse transition occurs (the overlay slides back in), creating a noticeable and distracting visual glitch where the home screen flashes in and out.
Steps to Reproduce
- Launch Megingiard and open the Fullscreen Touchpad overlay or Virtual Keyboard.
- Tap the Settings (gear) icon on the top toolbar.
- Observe the bottom screen during the transition:
- The touchpad/keyboard overlay slides down and exits.
- The MacroPad home screen / default canvas is briefly visible.
- The settings screen / dialog fades in.
- Close the settings screen:
- The overlay slides back in from the bottom.
Root Cause Analysis
In AppStateManager.kt:
_isFullscreenMouseActive and _isFullscreenKeyboardActive state flows were historically coupled to _uiMode.value == UiMode.TOUCHPAD and _uiMode.value == UiMode.KEYBOARD.
- When the user taps the settings icon,
_uiMode transitions to TOUCHPAD_SETTINGS or KEYBOARD_SETTINGS.
- Because
_uiMode was no longer strictly equal to TOUCHPAD or KEYBOARD, isFullscreenMouseActive / isFullscreenKeyboardActive immediately flipped to false.
- In
MultiCutoutContainer.kt / KeyboardScreen.kt, the AnimatedVisibility wrapper observing isFullscreenMouseActive / isFullscreenKeyboardActive triggered its exit transition, dropping the overlay and revealing the base layer (MacroPad).
Expected Behavior
Opening or closing the Touchpad / Keyboard settings should be treated as an in-place modal overlay over the active touchpad/keyboard. The underlying overlay container should remain persistent in the background rather than collapsing and exposing the home screen.
Proposed Fix / Resolution
- Update
isFullscreenMouseActive and isFullscreenKeyboardActive in AppStateManager.kt to preserve their active state when _uiMode is TOUCHPAD_SETTINGS or KEYBOARD_SETTINGS:
val isFullscreenMouseActive: StateFlow<Boolean>
// Persists true when entering TOUCHPAD_SETTINGS from active fullscreen mouse
val isFullscreenKeyboardActive: StateFlow<Boolean>
// Persists true when entering KEYBOARD_SETTINGS from active fullscreen keyboard
- When returning from settings, restore
_uiMode smoothly without tearing down or re-animating the overlay container.
[Bug]: Opening Touchpad/Keyboard Settings momentarily collapses overlay and flashes MacroPad Home screen
Description
When the user is in Fullscreen Touchpad (
_uiMode = TOUCHPAD) or Fullscreen Keyboard (_uiMode = KEYBOARD) mode and taps the top-right Settings gear icon, the overlay unexpectedly begins a ~250ms slide-down exit animation (slideOutVertically). This momentarily exposes the underlying MacroPad Home screen before the Settings modal overlay appears.When closing the Settings dialog, the reverse transition occurs (the overlay slides back in), creating a noticeable and distracting visual glitch where the home screen flashes in and out.
Steps to Reproduce
Root Cause Analysis
In
AppStateManager.kt:_isFullscreenMouseActiveand_isFullscreenKeyboardActivestate flows were historically coupled to_uiMode.value == UiMode.TOUCHPADand_uiMode.value == UiMode.KEYBOARD._uiModetransitions toTOUCHPAD_SETTINGSorKEYBOARD_SETTINGS._uiModewas no longer strictly equal toTOUCHPADorKEYBOARD,isFullscreenMouseActive/isFullscreenKeyboardActiveimmediately flipped tofalse.MultiCutoutContainer.kt/KeyboardScreen.kt, theAnimatedVisibilitywrapper observingisFullscreenMouseActive/isFullscreenKeyboardActivetriggered its exit transition, dropping the overlay and revealing the base layer (MacroPad).Expected Behavior
Opening or closing the Touchpad / Keyboard settings should be treated as an in-place modal overlay over the active touchpad/keyboard. The underlying overlay container should remain persistent in the background rather than collapsing and exposing the home screen.
Proposed Fix / Resolution
isFullscreenMouseActiveandisFullscreenKeyboardActiveinAppStateManager.ktto preserve their active state when_uiModeisTOUCHPAD_SETTINGSorKEYBOARD_SETTINGS:_uiModesmoothly without tearing down or re-animating the overlay container.