# Cursor stuck in pointer after putting scene to sleep

**URL:** <https://phaser.discourse.group/t/cursor-stuck-in-pointer-after-putting-scene-to-sleep/12521>\
**Category:** Phaser 3\
**Created:** [November 8, 2022, 1:17am UTC](https://phaser.discourse.group/t/cursor-stuck-in-pointer-after-putting-scene-to-sleep/12521 "2022-11-08T01:17:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabrieltaets](https://avatars.discourse-cdn.com/v4/letter/g/45deac/32.png) [@gabrieltaets](https://phaser.discourse.group/u/gabrieltaets)\
**Post date:** [November 8, 2022, 1:17am UTC](https://phaser.discourse.group/t/cursor-stuck-in-pointer-after-putting-scene-to-sleep/12521/1 "2022-11-08T01:17:21Z")

</div>

Hey!  
I have a scene registering an interactive Close button, and I want to put the scene to sleep when this button is clicked.  
Everything _kinda_ works, but the cursor is stuck in pointer mode when the scene sleeps. When waking the scene up, the pointer goes back to normal. I figure it’s because Phaser has no time to reset the pointer before putting the scene to sleep, but I don’t know how to fix this.

Use case is a sort of modal scene that gets rendered on top of the main scene.

Here’s a minimal working example:

```javascript
class MainScene extends Phaser.Scene {

    constructor() {
        super("main");
    }

    create () {
        const btn = this.add.text(400, 100, 'Open Modal')
            .setOrigin(0.5)
            .setInteractive({ useHandCursor: true })
            .on('pointerover', () => btn.setStyle({ fill: "#f39c12" }))
            .on('pointerout', () => btn.setStyle({ fill: "#fff" }))
            .on('pointerdown', () => this.scene.run('modal'));
    }
}

class ModalScene extends Phaser.Scene {

    constructor() {
        super("modal");
    }

    create () {
        const bounds = this.add.rectangle(400, 300, 400, 300, 0x222222, 1)
            .setOrigin(0.5)
            .getBounds();

        const btn = this.add.text(bounds.right - 10, bounds.top + 10, 'Close')
            .setOrigin(1, 0)
            .setInteractive({ useHandCursor: true })
            .on('pointerover', () => btn.setStyle({ fill: "#f39c12" }))
            .on('pointerout', () => btn.setStyle({ fill: "#fff" }))
            .on('pointerdown', () => this.scene.sleep('modal'));
    }
}

var config = {
    type: Phaser.AUTO,
    parent: 'phaser-example',
    width: 800,
    height: 600,
    scene: [MainScene, ModalScene],
    backgroundColor: '#000000'
};

var game = new Phaser.Game(config);

```

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [November 8, 2022, 2:55pm UTC](https://phaser.discourse.group/t/cursor-stuck-in-pointer-after-putting-scene-to-sleep/12521/2 "2022-11-08T14:55:03Z")

</div>

```
this.input.setDefaultCursor('');

```

will do it I think.
