-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 template part focus mode resizable editor height #43408
Conversation
Size Change: +36 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
9de9b87
to
7bee808
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for picking this up, @talldan 🙇
The fix works well in my tests ✅
I couldn't debug why RAF wasn't working, but switching to setTimeout
to defer the action makes sense.
|
||
setHeight( iframe.contentDocument.body.scrollHeight ); | ||
timeoutId = null; | ||
}, 40 ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is 40
just an arbitrary delay here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was 25 fps, but I've decided to change it to 30fps, which should be closer to requestAnimationFrame
.
a853092
to
3101946
Compare
Thanks for fixing this one, was really degrading the experience |
What?
Fixes #42226
It seems like #38855 switching the iframe to standards mode changed a few aspects of how the iframe behaves:
requestAnimationFrame
doesn't work. I could see it would get triggered but the callback never called. Possibly it doesn't work until the document is ready. The code that sets the height was within arequestAnimationFrame
for throttling, so that was the first issue. I've switched tosetTimeout
iframe.contentDocument.documentElement.scrollHeight
always seems to be whatever the pixel value is for100%
height in standards mode. I've switched toiframe.contentDocument.body.scrollHeight
.iframe.contentDocument.body
isn't defined and an error is thrown.Testing Instructions
Adds an e2e test(I did write an e2e test for this, but it was too unstable, I couldn't find a way to wait for the focus mode to finish loading and resizing, it's now removed)Expected: the editable area should be the height of the content
In trunk: the editable area is the height of the viewport
Screenshots or screencast
Before
Kapture.2022-08-19.at.16.27.18.mp4
After
Kapture.2022-08-19.at.16.25.57.mp4