Skip to content

Quirky behavior of particular ::before pseudo element CSS transition #39225

@stevennovaryo

Description

@stevennovaryo

Describe the bug:
For a particular container that has a ::before pseudo element and transition, the transition could stop midway unexpectedly.

Servo-39225.mp4

To Reproduce:

Run the following HTML,

<!DOCTYPE html>
<style>
    .container::before {
        content: "";
        display: block;
        transition: width .5s;
        width: 0;
        height: 10px;
        background-color: red;
    }
    .container.active::before {
        width: 100px;
    }
</style>
<div class="container">
    Click me!
</div>
<div class="container">
    Don't click me!
</div>
<script>
    let isActive = false;
    const target = document.getElementsByClassName("container")[0];
    target.onclick = () => {
        isActive = !isActive;
        target.className = isActive ? "container active" : "container";
    };
</script>

And follow the sequence of operation.

  1. Click the first <div> container containing Click me!.
  2. Immediately flick cursor. moving it out from the container.
  3. Try again if you did not see the transition error.

Platform:
Not a platform dependent bug.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions