29

In Safari iOS15, by default, the address bar is pinned to the bottom of the viewport. As iOS 15 Safari floating address bar explains, you can use padding-bottom: env(safe-area-inset-bottom) to ensure content displays above it.

However, if the keyboard is visible, the env vars don't work, because the floating address bar is shown above the keyboard, and it clears the bottom of the viewport. This can cause some content to be hidden below it.

Here is a simple demo of the issue: https://pmusaraj.github.io/ios15-bottom-bar2.html

On iOS 14 and below or on iOS15 with Safari set to show the address bar at the top, you can see the submit button when the textarea is in focus. On default iOS15, you can't, because the viewport height returned by the device does not include the floating address bar.

Update: WebKit bug report at https://bugs.webkit.org/show_bug.cgi?id=229876

5
  • 1
    Have you made any progress with this as I am also seeing a value of 0px for the safe-area-inset-bottom when the keyboad is open Commented Sep 1, 2021 at 13:31
  • 2
    Maybe it's related with Known Issues of iOS 15 beta. Issue number 81676564. Commented Sep 2, 2021 at 19:08
  • I may be missing the obvious, but what is the question being asked here? Commented Sep 7, 2021 at 17:08
  • The question is: is there a way to detect that bottom-pinned floating address bar when the keyboard is vislbe? Commented Sep 7, 2021 at 18:38
  • 1
    This is another great demo of the issue: pmusaraj.github.io/ios15-bottom-bar2.html Commented Oct 9, 2021 at 14:16

2 Answers 2

8
+125

The closest solution I could find is to check for the presence of iOS 15 with navigator.userAgent:

console.log(navigator.userAgent.indexOf("iPhone OS 15") != -1)

However, the user can still change the tab bar location in settings back to the top.

The below screenshot is from testing it in the Xcode iPhone simulator and using the development tools in safari to inspect the browser

Check the output in this screenshot

Sign up to request clarification or add additional context in comments.

3 Comments

I like it! But it doesn’t get us there as you say. Closer though!
Note that it seems to be fixed in iOS 15.1. I'm using the regex /(iPad; CPU|iPhone) OS 15_0/i in order to test only iOS 15.0 but also catch both iPhones and iPads.
@Knox Thanks... By this we can get any version of OS and any kind of browser and that will help in future releases of Safari / iOS , so we can put CSS/JS for that part only. Thanks lot....
3

This seems to have been fixed in iOS 15 developer beta 3.

1 Comment

It is still broken in the production version, I think. See pmusaraj.github.io/ios15-bottom-bar2.html for another good example

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.