Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[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

Merged
merged 2 commits into from
Nov 27, 2024

Conversation

matthew-carroll
Copy link
Contributor

[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 a KeyboardPanelScaffold.

Then the app navigates to Screen 2.

Screen 2 contains a KeyboardScaffoldSafeArea but doesn't contain a KeyboardPanelScaffold.

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, the KeyboardScaffoldSafeArea 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 a MediaQuery, it continues to honor the MediaQuery changes. Then, if a descendant ever explicitly sets the insets on the KeyboardScaffoldSafeArea, it stops paying attention to the MediaQuery.

…o screen with no IME connection, KeyboardScaffoldSafeArea pushes the content up above the keyboard even though its closed. (Resolves #2419)
Copy link
Collaborator

@angelosilvestre angelosilvestre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a single comment.

bottomPadding: _ancestorSafeArea?.geometry.bottomPadding ?? MediaQuery.paddingOf(context).bottom,
);

// We track whether our safe is from MediaQuery (instead of an another KeyboardSafeAreaGeometry).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"We track whether our safe is" > "We track whether our safe area is" ?

@matthew-carroll matthew-carroll merged commit e19e5ad into main Nov 27, 2024
12 of 14 checks passed
@matthew-carroll matthew-carroll deleted the 2419_keyboard-safe-area-bug branch November 27, 2024 00:52
github-actions bot pushed a commit that referenced this pull request Nov 27, 2024
…o screen with no IME connection, KeyboardScaffoldSafeArea pushes the content up above the keyboard even though its closed. (Resolves #2419) (#2421)
matthew-carroll added a commit that referenced this pull request Nov 27, 2024
…o screen with no IME connection, KeyboardScaffoldSafeArea pushes the content up above the keyboard even though its closed. (Resolves #2419) (#2421)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SuperEditor] - Keyboard panel scaffold thinks keyboard is up when it's down on new screen
2 participants