Skip to content

Fix Crashing issue with keyboard scrolling iOS #28148

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

Merged
merged 3 commits into from
Mar 6, 2025
Merged

Conversation

tj-devel709
Copy link
Member

@tj-devel709 tj-devel709 commented Mar 3, 2025

Description of Change

This PR adds some checks so that we don't crash when the an editor/entry is unfocused and the keyboard goes away, but that editor/entry's Window is null. This one is pretty tricky to test so we may just add this now and keep trying on the test.

Issues Fixed

Fixes #28140

@PureWeen PureWeen added this to the .NET 9 SR5 milestone Mar 3, 2025
@PureWeen PureWeen moved this from Todo to In Progress in MAUI SDK Ongoing Mar 3, 2025
@PureWeen PureWeen added the p/0 Work that we can't release without label Mar 4, 2025
@tj-devel709 tj-devel709 marked this pull request as ready for review March 5, 2025 22:21
@Copilot Copilot AI review requested due to automatic review settings March 5, 2025 22:21
@tj-devel709 tj-devel709 requested a review from a team as a code owner March 5, 2025 22:21
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR addresses a crash caused by keyboard dismissal when the associated editor/entry's window is null by adding additional null-checks.

  • Added responder window null-checks in ViewExtensions.cs.
  • Updated the condition in KeyboardAutoManagerScroll.cs to verify that LastScrollView’s window is not null before proceeding with animations.

Reviewed Changes

File Description
src/Core/src/Platform/iOS/ViewExtensions.cs Introduces window null-checks in the responder chain to avoid accessing disposed views (note: using "return null;" in a void method could be problematic).
src/Core/src/Platform/iOS/KeyboardAutoManagerScroll.cs Adjusts the keyboard hiding animation invocation by verifying that LastScrollView is attached to a window.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

src/Core/src/Platform/iOS/ViewExtensions.cs:772

  • Returning null from a method declared with a void return type is a compile error; consider using 'return;' instead or update the method's return type if a null value is intended.
return null;

src/Core/src/Platform/iOS/ViewExtensions.cs:792

  • Returning null from a method declared with a void return type is a compile error; consider using 'return;' instead or update the method's return type if a null value is intended.
return null;

@PureWeen PureWeen moved this from In Progress to Ready To Review in MAUI SDK Ongoing Mar 6, 2025
@github-project-automation github-project-automation bot moved this from Ready To Review to Approved in MAUI SDK Ongoing Mar 6, 2025
@rmarinho rmarinho merged commit abe9a73 into main Mar 6, 2025
115 of 123 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Mar 6, 2025
@rmarinho rmarinho deleted the dev/TJ/ScrollWindowNull2 branch March 6, 2025 15:27
bhavanesh2001 pushed a commit to bhavanesh2001/maui that referenced this pull request Mar 7, 2025
* check the window

* check each responders window

* check LastScrollView Window
rmarinho pushed a commit that referenced this pull request Mar 11, 2025
* check the window

* check each responders window

* check LastScrollView Window
@github-actions github-actions bot locked and limited conversation to collaborators Apr 6, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-entry Entry p/0 Work that we can't release without platform/iOS 🍎
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Keyboard Scrolling Crash
3 participants