Bug found in iOS Safari causing rendering issues during transition from overflow:hidden

Here is a demonstration of the bug I have identified: http://codepen.io/benfrain/full/PZjpxr

In iOS Safari, a peculiar issue occurs when transitioning an element from outside an overflow:hidden container back into it. The element only displays after the transition completes.

.wrapper {
  height: 200px;
  width: 200px;
  overflow: hidden;
}

.item {
  transition: transform 1s;
}

.toggled .item {
    transform: translate3d(0, 300px, 0);
}

This behavior is most noticeable on iOS 9, but even in iOS 9.2 it persists after multiple runs of the transition. It seems to affect elements containing text specifically. On the other hand, the empty red item transitions correctly.

Are there any alternative solutions that do not involve using margin-top for vertical movement?

Answer №1

TLDR Remember to add position: fixed to the element with hidden overflow

Check out this CodePen example for reference

Spent hours grappling with an issue related to overflow: hidden. It's a challenge navigating through numerous unhelpful responses when searching for solutions, but surprisingly stumbled upon this gem of a post.

It's strange how such a common problem isn't widely discussed and documented. Isn't it odd?

I recalled encountering a similar problem in the past where mobile browsers tend to ignore overflow settings on body and html with specific viewport meta tags. The workaround involves using an inner wrapper element with overflow set on it along with applying fixed positioning to fully address the issue. (the reason behind this remains a mystery)

The viewport meta tags aren't the cause in this scenario; rather, it's the magic touch of position: fixed that does the trick. Make sure to apply it to the element with overflow hidden setting, whether it's the immediate parent or further up the hierarchy.

This might explain why many users haven't encountered this glitch frequently. Those who have attempted transitioning a sidebar navigation would encounter the body overflow issue mentioned earlier and probably had already applied position: fixed to a parent container unintentionally resolving this issue as well.

Take note that utilizing overflow/fixed positioning on an inner element could result in content flow disruptions leading to other complications.

Answer №2

If you're still on the lookout for a solution, make sure to add the will-change style in both your .testItem and .goThing classes.

.testItem {
  will-change: transform;
  width: 50%;
  height: 300px;
  background-color: #f90;
  transform: none;
  transition: transform 2s;
  .goThing & {
    transform: translate3d(0, 500px, 0);
    will-change: auto;
  }
}

Initially, it appeared that only the .testItem class needed this style, but it turns out that the .goThing class requires it as well for proper functionality on iOS devices. The reason behind this requirement remains unclear. Testing was performed on an iPad Pro running iOS 9.2 with successful results.

UPDATE:

Following feedback, it appears that the initial approach did not yield the desired outcome. However, using animations instead of transitions proved effective. One potential downside is the ability to click the button before the animation completion (though this can be managed based on specific requirements).

http://codepen.io/Ostos/pen/EWVJqe

Answer №3

Perhaps the solution provided below can resolve the issue:

Issue with CSS3 scale transform and overflow:hidden on Safari

According to the suggestion, consider using mask-image or clip-path as alternatives to replace overflow:hidden

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

Employ a category from a custom iOS framework

I've been struggling to find a solution, but so far my search has come up empty. Creating a custom Framework (using jverkoey/iOS-Framework) has been a game-changer for me. It's a versatile collection of various frameworks and tools that I incorp ...

Animating gradient transitions vertically and horizontally

How can I animate a color change in a unique way? [UIView animateWithDuration:1.0 delay:0.2 options:UIViewAnimationOptionCurveEaseIn animations:^{ self.view.backgroundColor = [UIColor greenColor]; } completion:^(BOOL finished) { NSLog(@"Green Co ...

Separating stylesheets, head, and other elements in a curl response

After successfully using curl to retrieve an external site, I noticed that the results were interfering with my own content. The CSS from the external site was affecting my webpage's layout and z-index values were conflicting. I am seeking a solution ...

The Three.js IEWebGL Plugin

After developing a code that successfully rotates a cube with trackball using the three.js library and webgl, I encountered compatibility issues when trying to run it on Internet Explorer 10. Despite downloading IeWebgl to assist in making it run on IE10 ...

What are the steps involved in creating a radial menu design?

Button Panel Is it possible to replicate the Button Panel shown in the link above using HTML and CSS? The white shapes are actually buttons. ...

Unable to conceal the scrollbar while keeping the div scrollable

I've been attempting to implement the techniques outlined in the guides on this site, but I'm encountering difficulty hiding the scroll bar while still maintaining scrolling functionality! My current approach involves setting the parent as relat ...

Using the jQuery method `fadeToggle` to handle the functionality of multiple buttons toggling hidden text

I am struggling to make fadeToggle work properly. I want to reveal text when clicking on another div. Since I plan to use this for multiple elements, I am looking for a smart and efficient way to handle them all. Here is my current attempt which does not ...

The AVAssetWriter records a video featuring nothing but a blank screen

While attempting to append PixelBuffer using the code snippet below, I am encountering a problem where the output video displays as a black screen despite the CIImage appearing normal. It seems that the issue may lie within the 'newPixelBuffer' s ...

Update the color of navigation items to reflect their active status

Here is the snippet of HTML code: <header> <nav> <a href="#" id="menu-icon"></a> <ul> <li><a href="#"">Home</a></li> <li><a href="#">About</a></li> & ...

A guide to integrating Tailwind UI animations into pure HTML and JavaScript

I am struggling to implement the animation part of tailwindui.com components that I want to use. The instructions are provided in the comments, but I'm having trouble integrating them into my code. I prefer not to rely on any frameworks or libraries a ...

The jQuery bxSlider is failing to function properly in a responsive design

Anyone else experiencing issues with the jQuery bxSlider not functioning properly on a responsive layout? It seems to be working fine on larger screens. $(document).ready(function () { $('.slider1').bxSlider({ pagerCustom: '#bx-pager&apos ...

Internet Explorer is not honoring the max-width property when used in a select tag

When I use a select tag with a style of max-width: 150px, it works in FF but not in IE. So, I changed max-width to width: 150px and it works in both browsers. However, in IE, the text is truncated. Can anyone help me with this issue? Am I doing something ...

Stopping WKWebView from automatically underlining plain text as clickable URLs

I am facing an issue with rendering HTML content in a WKWebView. The content I want to display is as follows: <html> <body> <div>Here goes plain text google.com type of content</div> </body> </html> When I view this ...

Creating a full width and height slider with a header menu that is responsive to all device screen sizes

Looking to create a full-width slider with a header that adjusts for all screen sizes, especially larger devices. I've been searching online but haven't found a satisfactory solution yet. If anyone has any ideas or tips on how to achieve this, pl ...

Xcode: I'm perplexed by the blue selection line in my code. How can I remove it?

Can someone please help me with this issue I am having in my code? There is a mysterious blue line next to the line number that appears when I hover over it, selecting the code. I have no idea how it got there or how to remove it. Here are two screenshots ...

Apply CSS styling (or class) to each element of a React array of objects within a Component

One issue I'm facing involves adding specific properties to every object in an array based on another value within that same object. One such property is the background color. To illustrate, consider an array of objects: let myObj = { name: "myO ...

Angular text input with customizable placeholder text and embedded icon

Hey there, I'm looking to create a unique custom textbox that includes a text placeholder and a help icon that will display useful information in a popover. https://i.sstatic.net/Zh0IK.png When typing into the input, the textbox should have a specif ...

What is the best method for adjusting height in MaterialUI components?

Is there a way to remove this white line from the image?view image here When I set the height to 100%, it appears like this:view image here ...

Buttons are misaligned and do not align on a straight line

Below is the code output: https://i.stack.imgur.com/avhUu.png I am attempting to enhance the symmetry of these buttons. The minus (-) button appears slightly smaller than the plus (+) button even though they have the same padding. I have experimented w ...

what is the process of configuring attributes within an NSAttributedString on iOS?

Struggling to set the NSFontAttributeName property of an NSAttributedString in iOS and encountering issues: Initially, the NS constants appear undefined for iOS. It has been suggested to use CoreText consts as a workaround. However, the attribute require ...