Skip to content

Non-RTL texts created right after an RTL text was destroyed would not be shown in latest Chromium version #7077

Closed

Description

@Demeno

Version

  • Phaser Version: 3.60 & 3.88 (probably reproduces on others, but these are the versions I tested)
  • Operating system: Windows 10
  • Browser: Chrome 134 & Edge 134 (Does not reproduce on FireFox, or on earlier versions of Chrome / Edge)

Description

Since the latest Chrome update (134, released March 2025), when a text gameobject is destroyed, if that text gameobject was RTL, and the next created game object isn't RTL, that second text gameobject would not be displayed. Example:

const rtlText1 = this.add.text(200, 100, 'Text 1', {rtl: true});
rtlText1.destroy();

const regularText2 = this.add.text(200, 200, 'Text 2'); // In Chrome / Edge, Text 2 would not be shown!

Why This Happens

The new text gameobject uses the old game object's canvas from the CanvasPool, and that canvas's dir="rtl" isn't reset.

Hacky Workaround

in Phaser's code, in Phaser.Display.Canvas.CanvasPool.create, add the line canvas.removeAttribute('dir'); after the canvas variable is populated.

Example Test Code

Expected Result: Texts 2 & 3 would be shown
Actual Result: Only Text 3 is shown

class Example extends Phaser.Scene
{
    create ()
    {
        const rtlText1 = this.add.text(200, 100, 'Text 1', {rtl: true});
        rtlText1.destroy();
        
        const regularText2 = this.add.text(200, 200, 'Text 2'); // In Chrome / Edge, Text 2 would not be shown!
        const regularText3 = this.add.text(200, 300, 'Text 3');
    }
}

const game = new Phaser.Game({
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    parent: 'phaser-example',
    scene: Example
});

Activity

  1. zekeatchan commented on Mar 17, 2025

    @zekeatchan
    Contributor

    Hi @Demeno. Thanks for submitting this issue. We have fixed this and pushed it to the master branch. It will be part of the next release. Do test it out and let us know if you encounter any issues.

  2. added a commit that references this issue on Mar 17, 2025
    a2a28a7
  3. locked as resolved and limited conversation to collaborators on Sep 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions