Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unstable clipboard logic on web is incompatible with web_sys 0.3.70 #4961

Closed
simon-wh opened this issue Aug 14, 2024 · 4 comments · Fixed by #4980
Closed

unstable clipboard logic on web is incompatible with web_sys 0.3.70 #4961

simon-wh opened this issue Aug 14, 2024 · 4 comments · Fixed by #4980
Labels
bug Something is broken

Comments

@simon-wh
Copy link

I'm trying to use web_sys_unstable_apis in my project, but it started failing due to an error coming from some special clipboard logic in eframe.

The error:

   --> /Users/syte-laptop/.cargo/registry/src/index.crates.io-6f17d22bba15001f/eframe-0.28.1/src/web/mod.rs:187:16
    |
187 |         if let Some(clipboard) = window.navigator().clipboard() {
    |                ^^^^^^^^^^^^^^^   ------------------------------ this expression has type `Clipboard`
    |                |
    |                expected `Clipboard`, found `Option<_>`
    |
    = note: expected struct `Clipboard`
                 found enum `Option<_>`

The source:
https://github.com/emilk/egui/blob/master/crates/eframe/src/web/mod.rs#L171-L192

In v0.3.69 and before of web_sys, the return of .clipboard() is Option<Clipboard>. In v0.3.70, it is now just Clipboard

Thankfully, I'm able to just pin my web_sys dependency to =0.3.69 and I'm able to compile again

@simon-wh simon-wh added the bug Something is broken label Aug 14, 2024
@bircni
Copy link
Contributor

bircni commented Aug 14, 2024

@simon-wh Could you test if the branch from PR #4954 works for you?

@simon-wh
Copy link
Author

simon-wh commented Aug 14, 2024

@simon-wh Could you test if the branch from PR #4954 works for you?

Looks to be working 👍

Compiling that is, I'm not using this clipboard behaviour so I cannot validate the updated logic

This was referenced Aug 15, 2024
@bioinformatist
Copy link

I also met this problem. When will the #4954 be merged? 😄

@bircni
Copy link
Contributor

bircni commented Aug 25, 2024

@bioinformatist please have a look at #4980

emilk pushed a commit that referenced this issue Aug 26, 2024
This PR updates web-sys & wasm to the newest version.

(this was already part of the POC #4954 )

* Closes <#4961>
* Closes <#4958>
* [x] I have followed the instructions in the PR template
486c pushed a commit to 486c/egui that referenced this issue Oct 9, 2024
This PR updates web-sys & wasm to the newest version.

(this was already part of the POC emilk#4954 )

* Closes <emilk#4961>
* Closes <emilk#4958>
* [x] I have followed the instructions in the PR template
hacknus pushed a commit to hacknus/egui that referenced this issue Oct 30, 2024
This PR updates web-sys & wasm to the newest version.

(this was already part of the POC emilk#4954 )

* Closes <emilk#4961>
* Closes <emilk#4958>
* [x] I have followed the instructions in the PR template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants