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

[iOS] Fixed Using safe area causes white area at the top upon entry focus #26063

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

devanathan-vaithiyanathan
Copy link
Contributor

@devanathan-vaithiyanathan devanathan-vaithiyanathan commented Nov 22, 2024

Root Cause

When an Entry is focused and the keyboard opens, the view adjusts and scrolls downward, causing a white space to appear at the top of the screen.

Description of Change

In the AdjustPosition method, the move value is calculated when CursorRect.Y is less than topBoundary and CursorRect.Bottom is also less than bottomBoundar, which lead to unnecessary scrollling. To address this, a condition was added to ensure that if the move value is less than 0, it is reset to 0.

Issues Fixed

Fixes #25866

Validated the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

UseSafeArea and IgnoreSafeArea are most relevant on iOS alone due to the unique layout constraints of safe areas.

Output Screenshot

Before After

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Nov 22, 2024
Copy link
Contributor

Hey there @devanathan-vaithiyanathan! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Comment on lines +469 to +474

// no need to move the screen down if we can already see the view
if (move < 0)
{
move = 0;
}
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we'd want to always ignore this move down when we are in the safeArea space. Also consider when we are in a scrollview and we want the standard safe area and the next entry is in the top safe area space. In this example, we would expect that the scrollview scrolls down. Perhaps we can see if the IgnoreSafeArea is set, then we can change that top boundary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll revisit the implementation and analyze an alternate fix to restrict unnecessary scrolling when the keyboard opens. I'll ensure the behavior accommodates scenarios like ScrollView scrolling into the safe area correctly when required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[iOS] Using safe area causes white area at the top upon entry focus.
4 participants