{"action":"opened","issue":{"url":"https://api.github.com/repos/electron/electron/issues/19755","repository_url":"https://api.github.com/repos/electron/electron","labels_url":"https://api.github.com/repos/electron/electron/issues/19755/labels{/name}","comments_url":"https://api.github.com/repos/electron/electron/issues/19755/comments","events_url":"https://api.github.com/repos/electron/electron/issues/19755/events","html_url":"https://github.com/electron/electron/issues/19755","id":480781954,"node_id":"MDU6SXNzdWU0ODA3ODE5NTQ=","number":19755,"title":"Keyboard shortcuts broken in GTK+ dialogs","user":{"login":"ckerr","id":70381,"node_id":"MDQ6VXNlcjcwMzgx","avatar_url":"https://avatars3.githubusercontent.com/u/70381?v=4","gravatar_id":"","url":"https://api.github.com/users/ckerr","html_url":"https://github.com/ckerr","followers_url":"https://api.github.com/users/ckerr/followers","following_url":"https://api.github.com/users/ckerr/following{/other_user}","gists_url":"https://api.github.com/users/ckerr/gists{/gist_id}","starred_url":"https://api.github.com/users/ckerr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ckerr/subscriptions","organizations_url":"https://api.github.com/users/ckerr/orgs","repos_url":"https://api.github.com/users/ckerr/repos","events_url":"https://api.github.com/users/ckerr/events{/privacy}","received_events_url":"https://api.github.com/users/ckerr/received_events","type":"User","site_admin":true},"labels":[{"id":97403642,"node_id":"MDU6TGFiZWw5NzQwMzY0Mg==","url":"https://api.github.com/repos/electron/electron/labels/platform/linux","name":"platform/linux","color":"c7def8","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-08-14T16:46:33Z","updated_at":"2019-08-14T16:46:33Z","closed_at":null,"author_association":"MEMBER","body":"Introduced in PR #19725 to address issue #19663 \r\n\r\nThat change drops the underscores from the strings passed to the GTK dialog, which breaks the keyboard shortcuts for those dialog buttons.\r\n\r\nSee this similar [Chromium discussion](https://cs.chromium.org/chromium/src/chrome/browser/ui/libgtkui/select_file_dialog_impl_gtk.cc?type=cs&q=SelectFileDialogImplGTK::CreateFileOpenHelper&sq=package:chromium&g=0&l=40):\r\n\r\n```c++\r\n#if GTK_CHECK_VERSION(3, 90, 0)\r\n// GTK stock items have been deprecated.  The docs say to switch to using the\r\n// strings \"_Open\", etc.  However this breaks i18n.  We could supply our own\r\n// internationalized strings, but the \"_\" in these strings is significant: it's\r\n// the keyboard shortcut to select these actions.  TODO(thomasanderson): Provide\r\n// internationalized strings when GTK provides support for it.\r\nconst char kCancelLabel[] = \"_Cancel\";\r\nconst char kOpenLabel[] = \"_Open\";\r\nconst char kSaveLabel[] = \"_Save\";\r\n#else\r\nG_GNUC_BEGIN_IGNORE_DEPRECATIONS\r\nconst char* const kCancelLabel = GTK_STOCK_CANCEL;\r\nconst char* const kOpenLabel = GTK_STOCK_OPEN;\r\nconst char* const kSaveLabel = GTK_STOCK_SAVE;\r\nG_GNUC_END_IGNORE_DEPRECATIONS\r\n#endif\r\n```\r\n\r\ntl;dr the underscores are important.\r\n\r\nAlso relevant to the previous PR, Chromium appears to not suffer from the same translation issues. I don't know why that is but it may be worth investigating. Chromium [uses](https://cs.chromium.org/chromium/src/chrome/browser/ui/libgtkui/select_file_dialog_impl_gtk.cc?type=cs&q=SelectFileDialogImplGTK::CreateFileOpenHelper&sq=package:chromium&g=0&l=327) those `kFooLabel`s from above this way:\r\n\r\n```c++\r\nGtkWidget* SelectFileDialogImplGTK::CreateFileOpenHelper(\r\n    const std::string& title,\r\n    const base::FilePath& default_path,\r\n    gfx::NativeWindow parent) {\r\n  GtkWidget* dialog = gtk_file_chooser_dialog_new(\r\n      title.c_str(), nullptr, GTK_FILE_CHOOSER_ACTION_OPEN, kCancelLabel,\r\n      GTK_RESPONSE_CANCEL, kOpenLabel, GTK_RESPONSE_ACCEPT, nullptr);\r\n  SetGtkTransientForAura(dialog, parent);\r\n  AddFilters(GTK_FILE_CHOOSER(dialog));\r\n```\r\n\r\n* [x] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/master/CONTRIBUTING.md) for this project.\r\n* [x] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/master/CODE_OF_CONDUCT.md) that this project adheres to.\r\n* [x] I have searched the issue tracker for an issue that matches the one I want to file, without success.\r\n\r\n"}}
{"actor":{"display_login":"ckerr"}}