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

Mobile fixed toolbar: prevent whitespace and toolbar being scrolled off-screen #18945

Merged
merged 1 commit into from
Dec 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/edit-post/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@ export function initializeEditor( id, postType, postId, settings, initialEdits )

const isIphone = window.navigator.userAgent.indexOf( 'iPhone' ) !== -1;
if ( isIphone ) {
document.addEventListener( 'focusin', function( ) {
setTimeout( () => {
window.addEventListener( 'scroll', function( event ) {
Copy link
Member

Choose a reason for hiding this comment

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

So the purpose of this is to prevent scrolling on the window? Has the overflow technique been tried? (I don't see it mentioned in the comment.)

Copy link
Contributor

Choose a reason for hiding this comment

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

The purpose is to compensate for the scrolling that Mobile Safari does due to a very hacky decision to scroll up the html element whenever the softkeyboard is showing. The hack is better described in #18686 where the first version of this was merged.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Assuming we're talking about the same technique, we did try the overflow technique while testing various approaches when we were working on #18686. Unfortunately, most common approaches did not get us closer to fixing the issues we were seeing in mobile Safari as described in the previous PR as well as the related issue tickets.

if ( event.target === document ) {
window.scrollTo( 0, 0 );
}, 150 );
}
} );
}

Expand Down