rust-windowing / winit

Window handling library in pure Rust

Home Page:https://docs.rs/winit/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calling `preventDefault` on `keypress` events suppresses browser clipboard events

mvlabat opened this issue · comments

event.prevent_default();

This particular line of code prevents browsers to send clipboard events if winit's canvas is focused.

That makes it troublesome to add copy/cut/paste events support to UI frameworks.

I believe this problem has already been brought up in #1768, but copy/cut/paste wasn't explicitly called out there.

You can now use WindowBuilder::with_prevent_default(false).

Though ultimately this should also be solved by #2156 or #2831.

I researched this briefly, as far as I can tell you can change clipboard keybinds, so we could also expose an option to not use preventDefault() when we detect the clipboard keybinds.

Closing in favor of #2831, which might be extended to handle certain things like that.