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

fix: Fix crash when resizing page while editing a field. #8646

Merged
merged 2 commits into from
Nov 11, 2024

Conversation

gonfunko
Copy link
Contributor

@gonfunko gonfunko commented Nov 4, 2024

The basics

The details

Resolves

Fixes #7809

Proposed Changes

This PR fixes a crash that could occur when the window was resized while a field has focus/is being edited. Calling moveBy on a child block is invalid, but because FieldInput was bumping its parent block (potentially nested) during resizes, that invalid code path could be triggered. Instead, the root block of the FieldInput will be bumped into bounds if needed, which is safe. resizeEditor_() was also updated to wait for the active render to complete, since it needs to know the bounds of its parent block, which was causing rendering glitches.

@gonfunko gonfunko requested a review from a team as a code owner November 4, 2024 22:57
@gonfunko gonfunko requested a review from cpcallen November 4, 2024 22:57
@github-actions github-actions bot added the PR: fix Fixes a bug label Nov 4, 2024
Copy link
Contributor

@cpcallen cpcallen left a comment

Choose a reason for hiding this comment

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

LGTM but two tweaks suggested if you feel like improving the old code while you're at it.

core/field_input.ts Outdated Show resolved Hide resolved
core/field_input.ts Outdated Show resolved Hide resolved
@gonfunko gonfunko merged commit 9a7de53 into google:develop Nov 11, 2024
7 checks passed
@gonfunko gonfunko deleted the edit-resize-crash branch November 11, 2024 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resize while editing field leads to crash
2 participants