bevyengine / bevyengine/bevy

The published web examples panic when opening Print dialog

Open
#12,434 2 comments 0 reactions 0 assignees View on GitHub
A-Windowing C-Bug O-Web
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

ATOW, if I'm not mistaken, the web examples are using latest Bevy 0.13

## What you did

- Open any Bevy example, like this one: https://bevyengine.org/examples/2D%20Rendering/sprite/
- Open the print dialog of the browser. In Google Chrome, it is `File > Print...` or pressing `Ctrl+P` or `Cmd+P`
- Alternatively, you can call `print()` in the JS console
-
## What went wrong

The print dialog opens successfully, and even shows a picture of the canvas at the time of opening the dialog:

![image](https://github.com/bevyengine/bevy/assets/16073309/a16f6c2e-2c93-4ed2-adb2-a0ea91a26c13)

However, Bevy panics at `wasm_example.js:494 panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.10/src/platform_impl/web/web_sys/resize_scaling.rs:129:9:
created media query doesn't match, 2 != 2`

![image](https://github.com/bevyengine/bevy/assets/16073309/dc898906-66ec-44e9-8022-a7ea3038744e)

## Additional information

- I opened an issue on Winit's side: https://github.com/rust-windowing/winit/issues/3579 but apparently they can't reproduce on a minimal example
- Besides, it smells like it could be a browser's bug, because it is reproduceable in Google Chrome and Safari, but not in Firefox
- However, I'm opening this issue to Bevy because the asset being hit is a `debug_assert!` ([this one](https://github.com/rust-windowing/winit/blob/aaaf08972dee4ebdbee5d243d5022da76d3efd0c/src/platform_impl/web/web_sys/resize_scaling.rs#L129)), which shouldn't crash on release builds
- And, AFAIK, [Bevy builds the example showcase in Release mode](https://github.com/Maximetinu/bevy/blob/main/tools/example-showcase/src/main.rs#L22), so it shouldn't be crashing

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.