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

Add ability to speak typed text in password fields #17481

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions source/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,16 +353,15 @@ def setNavigatorObject(obj: NVDAObjects.NVDAObject, isFocus: bool = False) -> bo
return True


def isTypingProtected():
def isTypingProtected() -> bool:
"""Checks to see if key echo should be suppressed because the focus is currently on an object that has its protected state set.
@returns: True if it should be suppressed, False otherwise.
@rtype: boolean
:return: True if it should be suppressed, False otherwise.
"""
focusObject = getFocusObject()
if focusObject and focusObject.isProtected:
return True
else:
if config.conf["keyboard"]["speakPasswords"]:
return False
focusObject = getFocusObject()
isFocusProtected = focusObject is not None and focusObject.isProtected
return isFocusProtected


def createStateList(states):
Expand Down
1 change: 1 addition & 0 deletions source/config/configSpec.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
speechInterruptForEnter = boolean(default=true)
allowSkimReadingInSayAll = boolean(default=False)
alertForSpellingErrors = boolean(default=True)
speakPasswords = boolean(default=False)
handleInjectedKeys= boolean(default=true)
multiPressTimeout = integer(default=500, min=100, max=20000)

Expand Down
15 changes: 15 additions & 0 deletions source/globalCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,21 @@ def script_toggleSpeakCommandKeys(self, gesture):
config.conf["keyboard"]["speakCommandKeys"] = True
ui.message(state)

@script(
# Translators: Input help mode message for toggle speaking passwords.
description=_("Toggles on and off the speaking of passwords while typing"),
category=SCRCAT_SPEECH,
)
def script_toggleSpeakPasswords(self, gesture: "inputCore.InputGesture"):
toggleBooleanValue(
configSection="keyboard",
configKey="speakPasswords",
# Translators: The message announced when toggling the speak passwords setting.
enabledMsg=_("Allow speaking typed text in password fields on"),
# Translators: The message announced when toggling the speak passwords setting.
disabledMsg=_("Allow speaking typed text in password fields off"),
)

@script(
# Translators: Input help mode message for toggle report font name command.
description=_("Toggles on and off the reporting of font changes"),
Expand Down
10 changes: 10 additions & 0 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,15 @@ def makeSettings(self, settingsSizer):
if not config.conf["documentFormatting"]["reportSpellingErrors"]:
self.alertForSpellingErrorsCheckBox.Disable()

# Translators: This is the label for a checkbox in the
# keyboard settings panel.
speakPasswordsText = _("Allow speaking typed text in password fields")
self.speakPasswordsCheckBox = sHelper.addItem(
wx.CheckBox(self, label=speakPasswordsText),
)
self.bindHelpEvent("SpeakPasswords", self.speakPasswordsCheckBox)
self.speakPasswordsCheckBox.SetValue(config.conf["keyboard"]["speakPasswords"])

# Translators: This is the label for a checkbox in the
# keyboard settings panel.
handleInjectedKeysText = _("Handle keys from other &applications")
Expand Down Expand Up @@ -2108,6 +2117,7 @@ def onSave(self):
config.conf["keyboard"]["beepForLowercaseWithCapslock"] = self.beepLowercaseCheckBox.IsChecked()
config.conf["keyboard"]["speakCommandKeys"] = self.commandKeysCheckBox.IsChecked()
config.conf["keyboard"]["alertForSpellingErrors"] = self.alertForSpellingErrorsCheckBox.IsChecked()
config.conf["keyboard"]["speakPasswords"] = self.speakPasswordsCheckBox.IsChecked()
config.conf["keyboard"]["handleInjectedKeys"] = self.handleInjectedKeysCheckBox.IsChecked()
config.conf["keyboard"]["multiPressTimeout"] = self.multiPressTimeoutEdit.GetValue()

Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ To use this feature, "allow NVDA to control the volume of other applications" mu
* Automatic language switching is now supported when using Microsoft Speech API version 5 (SAPI5) and Microsoft Speech Platform voices. (#17146, @gexgd0419)
* NVDA can now be configured to speak the current line or paragraph when navigating with braille navigation keys. (#17053, @nvdaes)
* In Word, the selection update is now reported when using Word commands to extend or reduce the selection (`f8` or `shift+f8`). (#3293, @CyrilleB79)
* From keyboard settings, allow speaking typed text in password fields can be enabled so that real typed characters can be announced even in protected edit boxes (#17451, @nvdaes)

### Changes

Expand Down
5 changes: 5 additions & 0 deletions user_docs/en/userGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2641,6 +2641,11 @@ When enabled, NVDA will announce all non-character keys you type on the keyboard
When enabled, a short buzzer sound will be played when a word you type contains a spelling error.
This option is only available if reporting of spelling errors is enabled in NVDA's [Document Formatting Settings](#DocumentFormattingSettings), found in the NVDA Settings dialog.

##### Allow speaking typed text in password fields {#SpeakPasswords}

If this option is enabled, while typing in a protected edit box such as a password field, NVDA will be able to speak the real typed text, instead of replacing it with "star".
This option is off by default, but people who have difficulties using the keyboard may would like to turn it on, so that real typed characters can be reported even in protected fields.

##### Handle keys from other applications {#KeyboardSettingsHandleKeys}

This option allows the user to control if key presses generated by applications such as on-screen keyboards and speech recognition software should be processed by NVDA.
Expand Down
Loading