diff --git a/source/globalCommands.py b/source/globalCommands.py index dffe963a5f1..14c70c22ae5 100755 --- a/source/globalCommands.py +++ b/source/globalCommands.py @@ -2,9 +2,9 @@ # A part of NonVisual Desktop Access (NVDA) # This file is covered by the GNU General Public License. # See the file COPYING for more details. -# Copyright (C) 2006-2021 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, +# Copyright (C) 2006-2022 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, # Leonard de Ruijter, Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Łukasz Golonka, Accessolutions, -# Julien Cochuyt, Jakub Lukowicz +# Julien Cochuyt, Jakub Lukowicz, Bill Dengler import itertools @@ -2177,6 +2177,25 @@ def script_reportStatusLine(self, gesture): else: self.script_copyStatusLine(gesture) + @script( + description=_( + # Translators: Description for a keyboard command which reports the + # accelerator key of the currently focused object. + "Reports the shortcut key of the currently focused object.", + ), + category=SCRCAT_FOCUS, + gestures=("kb:shift+numpad2", "kb(laptop):NVDA+control+shift+."), + ) + def script_reportFocusObjectAccelerator(self, gesture: inputCore.InputGesture) -> None: + obj = api.getFocusObject() + if obj.keyboardShortcut: + res = obj.keyboardShortcut + else: + # Translators: reported when a user requests the accelerator key + # of the currently focused object, but there is none set. + res = _("No shortcut key") + ui.message(res) + @script( # Translators: Input help mode message for toggle mouse tracking command. description=_("Toggles the reporting of information as the mouse moves"), diff --git a/user_docs/en/changes.t2t b/user_docs/en/changes.t2t index e343f80fd67..4cac9bfcf21 100644 --- a/user_docs/en/changes.t2t +++ b/user_docs/en/changes.t2t @@ -6,6 +6,11 @@ What's New in NVDA = 2022.4 = == New Features == +- Introduced a new command to check the keyboard shortcut of the current focus. (#13960) + - Desktop: ``shift+numpad2`` + - Laptop: ``NVDA+ctrl+shift+.`` + - +- == Changes == diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index 16b63884942..cc7c398ded0 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -318,6 +318,7 @@ There are some key commands that are useful when moving with the System focus: | Report title | NVDA+t | NVDA+t | Reports the title of the currently active window. Pressing twice will spell the information. Pressing three times will copy it to the clipboard | | Read active window | NVDA+b | NVDA+b | reads all the controls in the currently active window (useful for dialogs) | | Report Status Bar | NVDA+end | NVDA+shift+end | Reports the Status Bar if NVDA finds one. Pressing twice will spell the information. Pressing three times will copy it to the clipboard | +| Report Shortcut Key | ``shift+numpad2`` | ``NVDA+control+shift+.`` | Reports the shortcut (accelerator) key of the currently focused object. | %kc:endInclude ++ Navigating with the System Caret ++[SystemCaret]