[SuperEditor] - Fix: When navigating from screen with keyboard open to screen with no IME connection, KeyboardScaffoldSafeArea pushes the content up above the keyboard even though its closed. (Resolves #2419) #2421
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[SuperEditor] - Fix: When navigating from screen with keyboard open to screen with no IME connection, KeyboardScaffoldSafeArea pushes the content up above the keyboard even though its closed. (Resolves #2419)
A situation was found in ClickUp where
KeyboardScaffoldSafeArea
wasn't doing what was expected.The app was on Screen 1 with an editor open, and keyboard up. This screen has a
KeyboardScaffoldSafeArea
and aKeyboardPanelScaffold
.Then the app navigates to Screen 2.
Screen 2 contains a
KeyboardScaffoldSafeArea
but doesn't contain aKeyboardPanelScaffold
.Screen 2 continues to show an empty area for the keyboard, even though the keyboard has closed.
The reason this happened is because when Screen 2 is first pumped and initialized, the keyboard is still up. Then, as Screen 2 animates in through the navigator, the keyboard closes.
The bug is that when there's not a descendant
KeyboardPanelScaffold
, theKeyboardScaffoldSafeArea
never updates its bottom insets. It initialized itself with the insets for the keyboard, but never reduced them as the keyboard closed.This PR adjusts the
KeyboardScaffoldSafeArea
so that if it initializes with insets from aMediaQuery
, it continues to honor theMediaQuery
changes. Then, if a descendant ever explicitly sets the insets on theKeyboardScaffoldSafeArea
, it stops paying attention to theMediaQuery
.