iOS 12 conceals Bootstrap modal iframe beneath content

Encountering an issue with Bootstrap 4.1 modals in Safari on iOS 12 when displayed within iframes, unlike other browsers including Safari on iOS 11. The problem appears to be specific to iOS 12.

A minimal example illustrating the problem has been created. The first two buttons work fine, but you can observe the issue with the last four as you go down, with the final one completely disappearing when trying to scroll or focus on an element inside the modal (refer to the screenshots below):

https://i.sstatic.net/KWUzJ.jpg https://i.sstatic.net/uL36h.jpg https://i.sstatic.net/G3tNu.jpg

Note that we are handling this functionality in a somewhat unconventional way by adjusting the iframe's height after loading through message passing between parent and child using a message event handler and postMessage: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage. I suspect something went wrong here (only noticed on iOS devices running version 12).

Edit

Recent findings reveal that this issue extends beyond Safari on iOS 12 to Chrome as well.

The code snippet below is extracted from the previous minimal example link:

Parent (/modal-test/index.html):

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>Title</title>

    <link rel="stylesheet" href="./bootstrap.min.css">

    <script src="./jquery.min.js"></script>
    <script src="./popper.min.js"></script>
    <script src="./bootstrap.min.js"></script>

    <script>
        $(document).ready(function(){

            $ifCon = $("#ifCon");

            window.addEventListener("message", function(event){
                if(event.data.method === "returnWindowSize"){
                    $ifCon.height(event.data.content);
                }
            }, false);

        });
    </script>

    <style>

        #ifCon {
            display: flex;
            width: 100%;
            height: 100%;
            flex-direction: column;
            background-color: #F2F2F2;
            overflow: hidden;
            border-radius:10px;
            border:1px solid grey;
            margin-left:auto;
            margin-right:auto;
            /*box-shadow:2px 2px 3px #000;*/
            box-shadow: 0px 1px 3px 0px rgba(0,0,0,0.75);
        }
        #ifCon iframe {
            flex-grow: 1;
            border: none;
            margin: 0;
            padding: 0;
        }

    </style>


</head>
<body>

    <div class="container">

        <div class="row">

            <div class="col text-center">

                <div id="ifCon">
                    <iframe height="100%" width="100%" scrolling="no" src="/modal-test/frameable.html"></iframe>
                </div>

            </div>

        </div>

    <...

    

Answer №1

We found that the solution to our problem was implementing hardware acceleration by adding specific CSS code within the <head></head> section of the child document (which was an element within an iframe in our situation):

<style>
    body{
        transform: translate3d(0,0,0);
    }
</style>

It's still a mystery as to why this fix works and why it is necessary for ios12 but not ios11. If anyone has any insight on this matter, it would be greatly appreciated and could potentially benefit others facing similar challenges.

Answer №2

To position the model-content exactly at the top of the parent document, you need to set the margin-top equal to the scroll height.

However, if you want some offset from the top, you can add a value like +80.

'margin-top':modalState.invokerElement.offset().top

'margin-top':parent.document.documentElement.scrollTop

Answer №3

When styling #ifCon in your CSS

#ifCon {
  height: 100vh;
 }

you can adjust the numbers to suit your liking, as VH sets a View Height to 100%.

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

What steps should I take to fix the following error: TypeError: undefined is not an object when trying to evaluate '_bip.default.generateMnemonic'?

I'm in the process of developing a mobile application and I find myself in need of utilizing bip39 for passphrase generation. However, after installing the necessary package, I encountered errors related to missing packages like stream buffer events. ...

Assigning an identification number to specify the type of Chip

I am currently working on a project involving Material UI "Chips" that contain text and serve as references. Within the context of my project, I have Chips for both White Advantages and Black Advantages sections. However, there are instances where these Ch ...

How to attach a custom event to a nested component in Vue.js when using a for loop

I have implemented a system using three single-file-components. ParentVariation.vue VariationInfo.vue Childvariation.vue In this setup, the variation-info child component emits a MarkedFilled event which is then caught by the ParentVariation component. ...

How can I display a pre-existing div with a dropdown button?

I have individual div elements for each type of clothing item (shirt, pant, suit) that I want to display when the corresponding service is selected. This means that when I click on one of them, only that specific div will be shown. I am looking for a solut ...

Issues with implementing KendoUI's datepicker in conjunction with Angular

My index.html file contains the following imports: <script src="content/js/angular.js"></script> <link href="content/js/kendo.common-material.min.css" rel="stylesheet" /> <link href="content/js/kendo.material.min.css" rel="styleshe ...

Leverage JSON data to generate individual elements, rows, and columns for every object within the array

Just starting out with JavaScript and struggling a bit. We need to fetch data from this URL: and then manipulate the data to create new rows (tr) and columns (td) for each game without altering the HTML file. The desired outcome should resemble this: http ...

Showing the output variable from node.js on a canvas

Is it possible to display the output of my node.js program, which consists of a series of points (x,y), on canvas without a browser? I came across this module that could potentially help with displaying the points: (https://www.npmjs.com/package/canvas) ...

Ways to conceal components on a different twig page in Symphony

I have a webpage with a list of products that, when clicked, leads to another page displaying the specific product. This new page extends the app.twig template, pulling all the elements from there. My question is, is it possible to hide certain elements ...

Personalized Radio Styling and Multi-line Text Wrapping

After customizing our radio buttons for a survey form using CSS, we encountered an issue where the text wraps below the replacement graphic when it is too long. We want to avoid modifying the HTML as it has been generated by our CRM system, and making chan ...

"Navigate with Ease: Introducing the Twitter Bootstrap Scroll

Having trouble with the twitter bootstrap scroll spy feature as the navigation doesn't update until midway through scrolling and skips item 4 to reach the last item. Check out this example: http://jsfiddle.net/eoboite/kjvAa/38/ What am I doing wrong? ...

How to efficiently structure CSS columns using Div elements within a Bootstrap card

<!-- New Blog Post --> <div class="card mb-4"> <img class="card-img-top" src="https://ichef.bbci.co.uk/news/660/cpsprodpb/948D/production/_109592083_mediaitem109591445.jpg" alt="Card image cap"> ...

Interacting with touch events in JavaScript on Android devices

I am facing an issue with my HTML page where a div is meant to function as an on-off switch momentarily. The functionality I have implemented looks like this: $('#btn').mousedown(function() { startAction() }) $('#btn ...

The HTML element update event was not triggered due to the excessive load of a JavaScript function

I am currently running a JavaScript function that is quite CPU intensive. To provide visual feedback to users when it starts and stops, I am attempting to display a badge on the webpage. Below is the code snippet: function updateView() { console.log(1 ...

Encountered a MongoNetworkError while attempting to establish a connection with the server at localhost:27017. The initial connection failed due to an ECONNREFUSED error at 127.0.0.1:

Encountered a MongoNetworkError: failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017 If I reinstall MongoDB, the code works fine. However, I am looking for a permanent solution. [error:MongoNetworkE ...

Slider fade animation not functioning as expected

Why won't the last slide display? How can I ensure that the first image is shown immediately after the side loads, without any delay? I've attempted various solutions but always encountered issues (such as displaying two images simultaneously) an ...

What is the method for executing a for loop in AngularJS without relying on HTML elements?

I'm creating an application in AngularJS where the structure requires me to execute a for each loop without using any HTML elements or div tags with ng-repeat. In Django, we typically use the following syntax: {% for item in list %} {{ item }} {% ...

Discovering the exact moment a user chooses a different answer in a quiz application using React

I'm currently developing a Quiz App that retrieves questions and answers from an API. My goal is to implement a feature that checks if the user selects the correct answer, their score increases by 1. However, if they change their mind and choose a wr ...

Issue in Three.js: The lower part of the mesh is not rendering

After converting a mesh from .obj to json using the official converter (https://github.com/mrdoob/three.js/tree/master/utils/converters/obj), I noticed that the mesh displays correctly from one side, but not the other. This seems to be due to the fact that ...

Error with Django and Bootstrap: The "form" parameter must include a valid Django Form

I am working on a Django application named 'Accounts' where I have extended the default User model provided by Django. The main goal is to allow each user to update their account information, which is stored in a model called UserProfile using th ...

Error encountered in the identify() method of Microsoft Face API

While utilizing Microsoft Face API with project oxford in JavaScript, I encountered an issue when using the "identify" function resulting in an error message of "Invalid request body." client.face.identify({ faces: arrayFaceId, personGroupId: "groupId ...