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

Some macOS keybindings do not work (Copy, Paste, Select all) #1691

Closed
3 tasks
Natrocx opened this issue Dec 5, 2023 · 3 comments · Fixed by #1696
Closed
3 tasks

Some macOS keybindings do not work (Copy, Paste, Select all) #1691

Natrocx opened this issue Dec 5, 2023 · 3 comments · Fixed by #1696
Labels
desktop Suggestions related to the desktop renderer

Comments

@Natrocx
Copy link

Natrocx commented Dec 5, 2023

Problem
Some keybindings like Cmd+A for select all, Cmd+c for copy or Cmd+v for paste, Cmd+x, Cmd+Z (and potentially others? im no macOS expert) do not work/do nothing. Other macOS specific keybindings like Cmd+backspace and Cmd+shift+left do work

Steps To Reproduce

Try to use the following code:

use dioxus::prelude::*;

fn main() {
    dioxus_desktop::launch(app);
}

pub fn app(cx: Scope) -> Element {
    render! {
      input {
        style: "width:100%;",
        value: "A lot of text to remove. Maybe you wish to select all to remove it?"
      }
    }
}

Expected behavior

Standard keybindings work the same as in Safari,

Environment:

  • Dioxus version: 0.4.0/git main
  • Rust version: 1.76.0-nightly
  • OS info: macOS 14.1
  • App platform: desktop

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later
@esimkowitz
Copy link
Contributor

On macOS, these keybindings need to be mapped to some action in the menu bar/context menu. This is how I set this up in my project: https://github.com/esimkowitz/dev-widgets/blob/main/src/environment/desktop.rs

@ealmloff ealmloff added the desktop Suggestions related to the desktop renderer label Dec 5, 2023
@pascalbehmenburg
Copy link
Contributor

I encountered this issue too and would like implement it as standard behaviour.

@ealmloff
Copy link
Member

ealmloff commented Dec 6, 2023

I encountered this issue too and would like implement it as standard behaviour.

I agree, this should be default behavior with a way to opt out in the window builder. If you are interested in adding this, we need to add a new option to the builder here and then apply the default window items here

pascalbehmenburg added a commit to pascalbehmenburg/dioxus that referenced this issue Dec 6, 2023
fixup naming and expose disable_default_menu_bar with builder function
jkelleyrtp added a commit that referenced this issue Jan 4, 2024
add default menu bar in dioxus-desktop to resolve #1691
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop Suggestions related to the desktop renderer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants