`event.pointerType` is missing in Safari browser

hello there!

I’m here to address an issue related to synthetic events and their cross-browser compatibility.
in this particular case, i noticed that the pointerType event property in Safari is simply undefined, yet it’s present within the same scenario in Chrome.

this property has been accessible in native Safari PointerEvent for a while and perhaps it would be possible to extend the info for simulated events as well.

here is the repro pg → Babylon.js Playground.

ps: I’m aware of possible workarounds for recognising the event source, yet I think it’s best to avoid them and have consistent information availability from within the babylon.

Adding @amoebachant (please be patient he is out on vacations for now:))

1 Like

Hi @noone, I’m back and can see the issue repro, thanks for the playground link! I’ll dig into the root cause soon. Thanks for reporting this!

I looked into the root cause today and the fix isn’t trivial, so I’ve opened an Issue to track this. Thanks for reporting it @noone!

1 Like

EDIT: @amoebachant sry, I just saw your comment on GitHub and it’s the same I wrote here :smiley:

Summary

Safari registers a mousemove and not a pointermove event thus it’s missing the pointerType property. We should remove this piece of code from tools.ts/public static GetPointerPrefix(engine: AbstractEngine): string or do the “bad os” checking only on old Safari versions because Safari already supports pointermove.

        // Special Fallback MacOS Safari...
        if (
            engine._badDesktopOS &&
            !engine._badOS &&
            // And not ipad pros who claim to be macs...
            !(document && "ontouchend" in document)
        ) {
            eventPrefix = "mouse";
        }
1 Like