The issue with disappearing HTML elements on input focus was resolved in iOS 8.3

I encountered a peculiar issue that bears resemblance to the fixed element problems on iOS highlighted on Stack Overflow, but with a unique twist. This anomaly only occurs when the parent document is scrollable and involves the use of an iframe. Below is a simplified representation of the HTML structure I am working with:

<body>
   /*
    main content
    */

   <div class="myCtrl"> 
     <iframe src="page2.htm"/> // iframe with input element within HTML page
     <div></div>
   </div>
</body>

.myCtrl is styled as follows:

 .myCtrl {
    max-width: none;
    max-height: 690px;
    width: 100vw;
    height: 75vh;
    bottom: 0;
    z-index: 1000;
    right: 0;
}

When certain input elements within the iframe are focused and the soft keyboard appears, .myCtrl gets pushed out of view. However, typing something brings .myCtrl back into view, displaying correctly. On removing focus from an input, .myCtrl remains visible and behaves as expected for the remainder of the browser session, regardless of any input focus.

Both the parent page and the iframe include the following viewport meta tag:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
.

Attempts to resolve the issue using meta tags have been unsuccessful. Using position:absolute is not viable as .myCtrl cannot receive event notifications from input focus.

Applying

-webkit-overflow-scrolling:touch;
is not feasible, as .myCtrl is appended to the body and the content structure is beyond my control.

Similarly, employing CSS font resizing has proven ineffective.

Answer №1

Dealing with a similar issue led me to come up with a solution that worked effectively for me. The problem stemmed from the Iframe container losing its fixed position and shifting to absolute.

To address this, my objective was to keep the container fixed when the keyboard was open, while also preventing excessive scrolling.

The code snippet below outlines the solution implemented:

window.onscroll = function () {//executes when the keyboard is open
    if (window.pageYOffset > window.innerHeight / 3) {//adjust as needed 
        window.scrollTo(0, window.innerHeight / 3);
        if (document.getElementById('IframeWrapperID').style.position !== 'fixed')  {
            document.getElementById('IframeWrapperID').style.position = 'fixed';
        }
    }
};

*I had set my iframe position to absolute initially. I trust this solution proves beneficial to you as well.

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

Conceal the PayPal Button

Currently, I'm facing a challenge where I need to dynamically show or hide a PayPal button based on the status of my switch. The issue is that once the PayPal button is displayed, it remains visible even if the switch is toggled back to credit card pa ...

What is the process for setting data to the value attribute in an input tag, retrieved from a firebase database?

I utilized the following code snippet to retrieve data from Firebase database and store it in the Name variable. var userId = localStorage.getItem('keyName'); var dbRefName = firebase.database().ref() .child(& ...

Having trouble displaying a dynamically created table using jQuery

I'm a newcomer to jQuery and I need help with querying 2 web services. The goal is to query the first service, use an attribute value to query the second one, and then populate a table with data from both services. Please take a look at my code on th ...

Shorten the text in a flex container using ellipsis and flex-grow

I have a "table" built using flex and I need to truncate the text in the first column if there isn't enough space, keeping it on a single line all the time. .parent { display: flex; border: 1px solid black; gap: 10px; } .first-column { bor ...

Even when applying a class, the CSS link:hover style will only affect the initial occurrence

I've hit a wall on this issue and can't seem to find a solution. I styled a few links using classes, but it seems that only the first link is accepting the :hover and :visited state styling. I made sure to use classes to style all of them. Not su ...

How come the values keep appearing without any loops or subsequent calls being made to the PHP file?

Here is a demo example showcasing 'Server Sent Events(SSE)': Embed HTML code(index.html) : <!DOCTYPE html> <html> <body> <h1>Receiving server updates</h1> <div id="result"></div> <script> if(type ...

Is it possible to dynamically append and delete rows of interconnected dropdown menus?

I'm currently working on a form that allows users to add and remove rows with cascading dropdowns for class selection. Everything is functional except for the feature to remove selected classes. I've experimented with different methods like the ...

Tips for playing .oga or .ogg files in an iOS applicationorWays to open

I'm looking to incorporate .ogg/.oga audio files from a remote URL into my iOS app. It's important to me that the audio can continue playing even when the app is in the background state. I've already experimented with this player, but unfor ...

Issue with image magnification on Internet Explorer 9 using the Cloud Zoom plugin extension for Joomla

Recently, I've been utilizing a Joomla plugin called cloud zoom to enhance our gallery by providing an image magnification effect when hovering over the large image. You can see it in action on this link here. While it works flawlessly on most browser ...

Reacting to multiple checkboxes in a check handling system

In my latest project, I have designed a component that utilizes multiple checkboxes generated within a .map function. While testing the functionality, it came to my attention that users could select more than one checkbox at a time. This is not ideal as th ...

How do I use CSS to organize data by row and column within a table?

I'm looking to format the table data in a column-row layout for mobile devices. Can anyone provide an example or guidance on how to achieve this? I've browsed through some discussions but haven't found a solution that works with tables. The ...

Retrieve the browser version of a client using C# (When Internet Explorer Compatibility mode is activated)

Is there a way to retrieve the actual version of the client's browser from C# code? Using Request.Browser or HTTP_USER_AGENT provides details, but in Internet Explorer (IE), when compatibility mode is enabled, it always returns IE 7 regardless of the ...

Restrict certain sections of the website to authorized users only

In my game project, players are presented with two options: to play the game itself or to view global and local highscores. I have implemented a signup and login system where upon successful login, users can choose among playing the game, checking highscor ...

Guidelines on creating actionable functions using JavaScript

Having trouble connecting the form to the database and looking for a solution. This is the HTML form that I've been working on, attempting both POST and GET methods. <form id="register" action="script/register.js" method="post"> <label for= ...

What is the best way to maintain the formatting of a textarea in the database?

My HTML form includes a text area and a functionality to save the data into a database upon submission. The issue arises when the saved data is retrieved from the database, as the original formatting of the text gets altered. For instance: "This is a text ...

The NativeAd IB Outlet is null when placed inside a tableview cell

let nativeAdCell = tableView.dequeueReusableCell( withIdentifier: "Ads", for: indexPath) as! NativeAds next (nativeAdCell.HeadlineView).text = nativeAd.headline (nativeAdCell.PriceView).text = nativeAd.price An error occurs while ...

What could be causing Typed.js to not function properly in my situation?

Having an issue with typed.js not functioning properly. Here is the code snippet: <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="js/jquery-1.11.3.min.js"></script> <!-- Include all compiled plugins ...

What is the right way to efficiently rotate a View in React Native?

Here is my code snippet: <View style={{borderColor:"red",borderWidth:4,flex:1,transform: [{ rotate:'90deg' }]}}> <Text>Hi</Text> </View> The result can be seen here: https://i.sstatic.net/C9ryl.jpg Unf ...

Capable of retrieving the identification number but incapable of executing a POST request

After successfully retrieving the ID using the router, I encountered an issue when trying to confirm the change of agent status on the retireagent HTML page by clicking the submit button. The error message displayed is "ID is not defined". I am seeking ass ...

Error: Unable to Locate CSS File for Wordpress Elementor

Currently in the process of transferring a WordPress website that utilizes Elementor. Successfully migrated both the code and database over. However, upon inspecting the page, I encountered a 404 error indicating that a css file associated with Elementor c ...