The sticky element is malfunctioning in iOS Chrome and is not working as expected

I recently encountered an issue with a sticky bar on a website (Gatsby) that appears at the bottom of the screen on one particular page. The sticky bar is implemented using position: sticky, and it works perfectly on all mobile browsers except for Chrome in iOS.

Here's the scenario:

First page: This page contains a list. Clicking on an item opens the second page in a new tab.

Second page: This is the page with the sticky bar, which also opens in a new tab.

The issue arises when transitioning from the first page to the second page via clicking on an item. In this case, the sticky bar gets covered by the bottom toolbar. However, if you directly visit the second page, the sticky bar functions correctly.

Have any of you faced a similar problem before? Is this potentially a bug within iOS Chrome or could there be an error in my implementation?

Below is the code snippet I'm using for the sticky bar:

.floating-bar {
  display: flex;
  position: sticky;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  bottom: 0;
  left: 0;
  z-index: 10;
  width: 100%;
  box-sizing: border-box;
  background: white;
  border-top: 1px solid #dfe1e6;
  height: 60px;
  overflow: hidden;
  // + some paddings based on the viewport
}

For visual reference, please check out the gifs below:

Answer №1

Although this answer may not be complete without a workaround at the moment, I am sharing this discovery here in case it brings us closer to a solution.

Experiment with running these two code snippets. The first one directs you to a website without using `target="_blank"` in the anchor element, meaning it opens in the same browser tab. The second code includes the target attribute, which results in opening a new tab. Interestingly, the sticky div displays correctly with the first code but only appears when the user has scrolled down with the second.

No target - functions correctly: goto site

With target - issue arises goto site

(unable to execute as a snippet apparently).

The presence of `target="_blank"` in the initial page's code seems to trigger a malfunction on Chrome IOS.

Update: Although the issue discussed in this post may not be identical, there were reported problems related to `target="_blank"` in Chrome on IOS. In some instances, removing `target="_blank"` resolved the issue. More information can be found at here.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Exploring the Potential of Inheriting from UIView/UIViewController

In order to streamline the process of incorporating custom buttons into my app, I am considering creating a separate view controller or view that subclasses UIView or UIViewController. This way, I can make changes in one place rather than having to updat ...

I'm experiencing an issue with my Next.js Airbnb-inspired platform where I am unable to save a listing to my favorites

While working on my Next.js Airbnb clone project, I encountered an issue with adding a Listing to favorites. The heart button component's color does not change when clicked, despite receiving a success response. Moreover, the addition to favorites is ...

The Content Security Policy is blocking other sources because it is set to 'self

Having these two inline script tags: <script async defer src="https://apis.google.com/js/api.js"></script> <script async defer src="https://accounts.google.com/gsi/client"></script> important to note: attempted ...

Implement vertical scrolling functionality in Material Grid widget

I'm working with a Material Grid that contains multiple items. <Grid container direction="row" justifyContent="flex-start" alignItems="flex-start"> <Grid item xs={5}> <Bo ...

Checking the validity of a React form within componentDidUpdate()

I am currently working on a form that involves a lot of complex logic, including auto-filling fields based on user input. It is also crucial for me to provide live validation while the user is typing. Initially, I manually called validators depending on t ...

Menu stack with content displayed to the right on larger screens

Given the content div's position (up middle), what method can I use to stack the divs in this manner? Is it possible to accomplish with only CSS or is jQuery necessary to move the div content out on larger screens? ...

upon reaching the conclusion of the animation without employing the .animate() method

I'm currently working on developing an iPad web application. The .animate() method doesn't meet the necessary speed requirements, so I've opted to utilize CSS for most of my transitions. How can I go about implementing html <div id="myG ...

Implementing AngularJS to display different divs according to the selected value

I am attempting to utilize the value of an HTML select element to toggle the visibility of specific div tags using AngularJS. Below is the code snippet I have been working with: <body ng-app="kiosk" id="ng-app" > <div class="page" ng-controll ...

Using jquery and css to allow hover effects and modify the color of active tabs

I need to modify the appearance of a tab in my left navigation menu so that it changes color when hovered over and remains that color when selected. I have limited experience with jQuery and CSS, so any guidance would be greatly appreciated! Below is the ...

Having trouble dispatching a TypeScript action in a class-based component

I recently switched to using this boilerplate for my react project with TypeScript. I'm facing difficulty in configuring the correct type of actions as it was easier when I was working with JavaScript. Now, being new to TypeScript, I am struggling to ...

I need assistance on combining two separate images within one div. Can someone provide guidance on how to achieve this?

Here is a way to place two images in one div, with one image at the top and the other at the bottom. Each image should take up approximately 25% of the width: <div class="images"> <div class="pics"> <img src="GRProvider/Img.jpg" ...

Align the image at the center of the screen with an overlay

Whenever an image is clicked, a lightbox appears. Currently, the image overlay is positioned at the top of the screen, but ideally, it should be centered on the user's screen. See the code snippet below: // The following script creates a lightbo ...

"Unpredictable behavior observed with useSWR hook or potential issues with outdated closure function

Within my React functional component, I have implemented a Lesson Video Player that functions similarly to Instagram Stories. Each lesson contains videos ("clips") with interactive elements that trigger a multiple-choice quiz for the user. Below is a simpl ...

An issue has been encountered with the Array.insert function, as the Object function Array() does not contain the 'insert' method

Currently, I am utilizing javascript, HTML, and HTTPHandlers. In my code, there is a line in javascript that looks like this: Array.insert( Garray, eval(firstmarker), tmparray); Upon testing this line in the Google Chrome console, I encountered the follo ...

Adjusting image width using jQuery

I have been experimenting with creating a Webgl hover effect for an image. The effect works well, but now I am trying to specify a width for the image within jQuery. new hoverEffect({ parent: document.querySelector('.ticket'), intensity1: 0. ...

Exploring the Potential of JSP in Form Submissions

Here's a OCWCD question that I encountered: <form action="sendOrder.jsp"> <input type="text" name="creditCard"> <input type="text" name="expirationDate"> <input type="submit"/> </form> The question based on the ...

Position a modal in the vertical center with scroll functionality for handling extensive content

Looking for ways to tweak a Modal's CSS and HTML? Check out the code snippets below: div.backdrop { background-color: rgba(0, 0, 0, 0.4); height: 100%; left: 0; overflow: auto; position: fixed; top: 0; width: 100%; z-index: 2020; } ...

Issue with hamburger icon functionality after updating class name with UseState in React

As I design a navigation bar for a website, everything seems to be functioning smoothly, including the hamburger menu when resizing the screen. However, the issue arises when trying to click the hamburger menu while scrolling down the page. By setting the ...

Storing the selected values from multiple checkboxes into an SQLite database with PHP PDO

Hi, I have two checkboxes named "Male" and "Female". If a person selects "Male" and does not select "Female", I want it to input nothing or false in the database. However, if "Female" is not selected, an error is returned: Undefined index: Female in /stora ...

What is the best way to generate a complete PDF of a webpage using pdfmake?

I'm currently developing a web application and facing the task of converting an HTML page, which contains multiple tables and datatables, to a PDF format. To achieve this, I've chosen to utilize the library pdfmake. Below is the script that I ha ...