dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.26k stars 1.76k forks source link

Fixed Keyboard Scrolling in editors with Center or End VerticalTextAlignment is off #25827

Open NirmalKumarYuvaraj opened 1 week ago

NirmalKumarYuvaraj commented 1 week ago

Issue Details

Sometimes, the editor cursor moves below the keyboard frame, causing it to render incorrectly. Once the editor content exceeds the editor's size, the cursor aligns properly above the keyboard frame.

Root Cause

The content offset of UITextView is set without consideration of keyboard frame. Causing the content to remain center even when the keyboard is open. As a result, the cursor goes below the keyboard frame.

Description of Change

The content offset of UITextView should be recalculated based on the keyboard frame value . We should check if the cursor's bottom position goes below the keyboard; we have to update the y position of the content offset based on the difference between the cursor's bottom position and the keyboard frame's top position. 

Validated the behaviour in the following platforms

Issues Fixed

Fixes #24977

Output

Before After
PureWeen commented 1 week ago

/azp run

azure-pipelines[bot] commented 1 week ago
Azure Pipelines successfully started running 3 pipeline(s).
rmarinho commented 6 days ago

/rebase

rmarinho commented 6 days ago

/azp run

azure-pipelines[bot] commented 6 days ago
Azure Pipelines successfully started running 3 pipeline(s).
rmarinho commented 4 days ago

/rebase

rmarinho commented 4 days ago

/azp run

azure-pipelines[bot] commented 4 days ago
Azure Pipelines successfully started running 3 pipeline(s).
jsuarezruiz commented 1 day ago

/azp run

azure-pipelines[bot] commented 1 day ago
Azure Pipelines successfully started running 3 pipeline(s).
tj-devel709 commented 1 day ago

Looks like this changed the behavior of the placeholder a tad. Looks like it is moved down a little and is being cut off a little bit on the top

Original is on the left, the diff is in the middle, and the new behavior from this PR is on the right

image