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

Copy/Paste and Other Keyboard Shortcuts Do Not Work on MacOS #2397

Closed
arpan-dhatt opened this issue Aug 11, 2021 · 7 comments
Closed

Copy/Paste and Other Keyboard Shortcuts Do Not Work on MacOS #2397

arpan-dhatt opened this issue Aug 11, 2021 · 7 comments

Comments

@arpan-dhatt
Copy link

arpan-dhatt commented Aug 11, 2021

Describe the bug

Keyboard shortcuts on MacOS such as cmd/a, cmd/c, cmd/v, cmd/x, cmd/z, and others do not work in the Tauri window. Right-click context menus do behave correctly, but using the keyboard shortcuts for equivalent actions create the system error sound.

To Reproduce

npm run tauri dev and attempt to use keyboard shortcuts to manipulate the field.

Expected behavior

The respective keyboard shortcut to do its default function.

Platform and Versions (required):

Operating System - Mac OS, version 12.0.0 X64

Node.js environment
  Node.js - 16.1.0
  @tauri-apps/cli - 1.0.0-beta.6
  @tauri-apps/api - Not installed

Global packages
  npm - 7.11.2
  yarn - Not installed

Rust environment
  rustc - 1.54.0
  cargo - 1.54.0

App directory structure
/node_modules
/public
/src-tauri

App
  tauri.rs - 1.0.0-beta.5
  build-type - bundle
  CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
  distDir - ../public
  devPath - http://localhost:8080

Additional context

Currently running on a MacOS 12.0.0 Public Beta, but this keyboard shortcut error doesn't appear in any other application. Some others were reporting this problem on #1055.

Edit: HTML markup

<html>
	<head>
		<title>Tauri Issue</title>
	</head>
	<body>
		<input type="text">
	</body>
</html>
@probablykasper
Copy link
Member

You can fix this by adding a menu

@fk1blow
Copy link

fk1blow commented Sep 4, 2021

sorry to resurrect this but i m having the same issues(macos as well), even after following the Creating a menu instructions to the letter.

Cannot use cmd+c nor cmd+v which is killing my mojo b/c this is a text editing app.

Edit: followed both 1055 and 2398 but couldn't understand if this should already work or not.

Edit 2: i'm a bit embarrassed but browsing through the examples/api manage to point me into the right direction; copy/paste actually works :D.

Would really appreciated any advice,
Thanks!

@sunhao8
Copy link

sunhao8 commented Oct 28, 2021

Edit: followed both 1055 and 2398 but couldn't understand if this should already work or not.

Edit 2: i'm a bit embarrassed but browsing through the examples/api manage to point me into the right direction; copy/paste actually works :D.

I try the solution you have mentioned, but cmd+c and cmd+v still do not work. Can you tell me the Edit 2?

@sunhao8
Copy link

sunhao8 commented Oct 28, 2021

Edit: followed both 1055 and 2398 but couldn't understand if this should already work or not.
Edit 2: i'm a bit embarrassed but browsing through the examples/api manage to point me into the right direction; copy/paste actually works :D.

I try the solution you have mentioned, but cmd+c and cmd+v still do not work. Can you tell me the Edit 2?

I've read examples/api carefully . you are right !
If others have the same problem!you just add 'Menu::new().add_native_item(MenuItem::Copy)' , cmd+c do its default function。

@serkandemirel0420
Copy link

nope, still not working. Any update?

@amrbashir
Copy link
Member

@serkandemirel0420 it does work, join our discord and we will help you triage it.

@nihilok
Copy link

nihilok commented Oct 31, 2024

Think the API has changed now, as none of the docs are the same and links in this thread are broken. For anyone trying to maintain an app on the old API I was able to fix this by having a dedicated Edit menu:

    let file_menu = Submenu::new("File", Menu::new().add_item(new_thread).add_item(history).add_item(quit));
    let edit_menu = Submenu::new("Edit", Menu::new().add_native_item(MenuItem::Copy).add_native_item(MenuItem::Paste).add_native_item(MenuItem::SelectAll));
    Menu::new().add_submenu(file_menu).add_submenu(edit_menu)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants
@fk1blow @probablykasper @serkandemirel0420 @arpan-dhatt @amrbashir @nihilok @sunhao8 and others