Could this be a glitch in the Safari CSS transition?

I've encountered a strange issue that seems to be a Safari CSS bug. The problem occurs when the element is being animated and it actually disappears during the CSS transition, only to reappear at its conclusion. Interestingly, this error only happens on Safari, as it works perfectly fine on Chrome and Firefox. Moreover, if the initial position of the animated element is less than half the width of the page, it also works correctly.

If you are using Safari, you can observe the issue here:

To see the problem in action, resize your browser window so that the text aligns with the right edge of the window. Click the Move button, and you will notice the text briefly disappearing and then reappearing in its new position. Press Unmove to bring it back to its original location.

Try making the browser window very wide, positioning the text (in its unmoved state) at the center, and then repeat the animation process. You'll find that everything works smoothly in this scenario.

Below is the complete code snippet:

<html>
<body>
<button onclick="move(true)">Move</button>
<button onclick="move(false)">Unmove</button>
    <div id="mover" style="position: relative;transition: transform 0.5s;">
        <div style="position: absolute; left: 800px;">
            <div>Close to right edge</div>
        </div>
    </div>
</body>
<script>
    function move(doMove) {
        document.getElementById('mover').style.transform = doMove ? "translate(-300px, 0)" : "translate(0, 0)";
    }
</script>
</html>

While it's possible that there may be some overlooked CSS issues causing this error, the fact that it functions properly in other browsers (and with a wider Safari window) suggests a Safari-specific CSS bug. The original code was generated by a CMS system, and the simplified version displayed above still exhibits the error. Suggestions on adjusting the layout of the web page are not helpful in this context. I have replicated this issue on Safari 13.01 and the WebKit nightly build.

-JM

Answer №1

You might want to consider incorporating -moz-transition: -moz-transform 0.5s into your CSS

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

Methods to maintain the select2 dropdown event open while interacting with another select2 dropdown

I have a situation where I need to dynamically add a class to a div whenever a select2 dropdown is open. To achieve this functionality, I am utilizing the open and close events of select2. The current code successfully adds the class when opening a selec ...

Encase a group of child elements within a parent container using

Currently, I am able to wrap an entire li-element in an ordered list with a link: $(e).wrap('<a href="#" onclick="window.open(\'/xyz/\');return false;"></a>'); This is the HTML construct: <li class=""> ...

Using jQuery and JSON: selecting classes based on associated JSON strings

If you want to see the complete codepen, I will share it here: http://codepen.io/JTBennett/pen/NdLWJy Let me try to simplify the problem. I have a click event that selects from a JSON object based on one of its string values. Text from various strings is ...

What is the best way to align an image underneath text?

I'm currently working on this design concept: https://i.stack.imgur.com/wJm0t.png Below the title, there is a particle image with half square images positioned on the top right and bottom left corners. My goal is to center the particle image below th ...

Is there a way to customize the CSS ul menu specifically for the JavaScript autocomplete feature?

I have created a search page with autocomplete for the first textbox, but I noticed that the ul/li CSS classes used for styling the main menu are impacting the JavaScript list. How can I override the menu styling to display a regular list format? Being a ...

Issue with Navbar collapse button not displaying items on Bootstrap 4.5.0 in combination with Next.js version 9.4.4

I'm currently working on a nextjs demo project where I'm incorporating bootstrap for styling purposes. The initial setup was straightforward as I installed bootstrap using npm and included it in my app.js. import 'bootstrap/dist/css/bootstra ...

How to align text vertically in columns by utilizing the column-count CSS property?

Utilizing the CSS column-count property, I have divided text into four columns on an HTML page. The issue is that the first column always seems to be slightly lower than the other three columns. To illustrate the problem in a straightforward manner, chec ...

Is the Button Class failing to retrieve the entire length of the div element?

I'm having an issue with the full length of the div not applying to the button inside. Can someone help me troubleshoot this problem? <div class="col-md-3 col-sm-6 text-center card"> <button type="button" class="btn btn-primary" data-toggl ...

An unexpected error has occurred in the browser console: The character '@' is not valid

I recently made the decision to dive into learning about Unit Testing with JavaScript. To aid in this process, I started using both Mocha.js and Chai.js frameworks. I downloaded the latest versions of these frameworks onto my index.html from cdnjs.com. How ...

Positioning an image/carousel at the bottom of multiple without the need for alignment

I'm in the process of creating a single-page website with sections stacked on top of each other, including a section where divs are stacked both next to and on top of each other. Within this section, there is a container div that holds 5 divs named bo ...

What is the best way to select the initial descendant that matches a specific

How can we target only the first matching descendant element, without affecting others further down the hierarchy? For example: If the HTML structure is like this: <div class="wrapper"> <table> <tbody> <tr> < ...

Struggling to contain the image inside my div element

I'm having trouble with keeping the image inside my div element as it keeps stretching outside of it. I've tried researching for a solution but haven't been successful in finding one. Any help would be greatly appreciated! Here is the HTML/ ...

Issue with displaying SVG files in VS Code using "Live Server" plugin

Recently, while updating my portfolio site, I encountered an issue with an image in SVG format. Surprisingly, when opening the page using VS Code's "Open with Live Server" feature, the image wasn't previewed. However, if I accessed the same page ...

Designing a dynamic patterned backdrop that seamlessly extends for a column in bootstrap

Experiencing some difficulties with Bootstrap and creating a resizable column background. In one row, there is a column with a fluid image at the top, another column below it with a CSS class that gives it a repeating background along the Y axis, and fina ...

Ensure that the side navigation panel is equal in height to the content

I'm struggling to make my right side navigation div fill up the remaining vertical space based on the content box size. I've experimented with setting the height of the body and the div to 100%, using absolute positioning, and even shedding a few ...

Adjusting height dynamically with CSS based on font size

Below is a link followed by a span element <a href="#" style="display:inline-block;font-size:900%">12</a> <span display="block">ACTIVE</span> The issue arises when the 'a' element does not have a specific height, causing ...

What is causing the disappearance of the images and animation when a class is added to the final column?

My goal is to create a continuous animation loop with 6 images. However, when I try to add the 6th image and include the "poster" class, none of the images appear on the screen. If I skip adding the "poster" class to the 6th image, the first 5 images disp ...

Writing CSS rules for generating HTML code when sending emails through the command line in Go

When trying to compose HTML with CSS for email delivery using Go command line execution, errors related to CSS properties are popping up. For instance, it's showing "not found" error in the terminal for properties like background: rgb(255, 255, 255) o ...

What is the most effective method to implement a toggle function using only JavaScript, without any reliance on jQuery?

Recently, I had a navigation bar in the form of an unordered list (ul) with multiple list items (li), and the last li element was labeled 'more' which had its own sub-menu in the form of another ul. To toggle this sub-menu between visible and hid ...

Building a dynamic tab menu using JavaScript: A step-by-step guide

In order to generate dynamic tab menus with JavaScript, I am seeking a solution that does not rely on jQuery as it may not be supported by all mobile devices. Any advice for replicating the same functionality using pure JavaScript would be greatly apprec ...