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

Search: Prevent visible page scroll when the search modal is open on iOS #392

Merged
merged 2 commits into from
Apr 26, 2023

Conversation

ryelle
Copy link
Contributor

@ryelle ryelle commented Apr 25, 2023

On iOS, opening the search modal in the header triggers the keyboard to open, which re-enables page scrolling. When scrolling down & back up, the page contents are visible in the gap behind the modal. This PR fixes the header bar on scroll, so that it hides that scrolled content.

It is still strange that the page can be scrolled, but the other fixes cause larger layout issues (see #371 (comment)), and this only happens when the keyboard is open (and only on iOS) this seems like the best solution.

Fixes #371, see #381, see #382.

Note: this PR also includes a small fix to prevent the icon-buttons from appearing active when the tab is closed, I only noticed it on mobile, so fixed it here.

Screenshots

Production PR
Home: block theme
Patterns: classic theme, has admin bar
Download: block theme, white header style
Download, with keyboard closed, modal behaves correctly (no scroll) no change

To test

I used Charles.app's DNS spoofing to send *.wordpress.org traffic to my sandbox, then set my iPad to use my computer as a proxy. This let me load my sandboxed environment on my iPad. Then using the vertical orientation, I tested the header across different wporg pages.

The button is still focused when the menu is closed, which makes it look active when using a pointer device. When using a keyboard, the outline also appears, which makes it clear where focus is.
@ryelle ryelle self-assigned this Apr 25, 2023
Copy link
Member

@iandunn iandunn left a comment

Choose a reason for hiding this comment

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

Looks good to me 👍🏻

One of the reasons I haven't circled back to this yet is that the upstream fix is still changing, so whatever we do here might not work in the near future. Since this is already working, though, I don't see any reason to avoid merging it.

@jasmussen
Copy link
Collaborator

I'm unable to test this in my local environment, but for those able to, I've had good success with the free Xcode simulator to test. If it works, ship it.

I also want to note that I appreciate that you shared your experiences on the upstream fix, so we can get this fixed at the core! Thank you 🙏

@fcoveram
Copy link
Collaborator

I see the search icon twice. The one in the placeholder should not exist, as my understanding. Is that a OS behavior?

@jasmussen
Copy link
Collaborator

Good catch, Francisco. I think I actually have an upstream fix for that: WordPress/gutenberg#48259 and WordPress/gutenberg#49710

@ryelle ryelle merged commit 7553f1c into trunk Apr 26, 2023
@ryelle ryelle deleted the fix/mobile-search-overlay branch April 26, 2023 15:38
ryelle added a commit that referenced this pull request May 30, 2023
This prevents other nav modals (like the page subnav) which toggle the has-modal-open class from affecting the position of the global header bar.

See #392, Fixes WordPress/wporg-parent-2021#85
ryelle added a commit that referenced this pull request May 31, 2023
* Header: Fix logo spacing on default English site

Fixes issue introduced in 43a8a94 where the menu & search icons collapsed to the left on small screens. The logo flex size needs to be different when there is no locale name.

* Header: Only apply page scroll fix to header modals

This prevents other nav modals (like the page subnav) which toggle the has-modal-open class from affecting the position of the global header bar.

See #392, Fixes WordPress/wporg-parent-2021#85
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Search: Mobile overlay does not properly lock the screen in place
4 participants