Skip to content

Commit

Permalink
Fix various accessibility issues (#9138)
Browse files Browse the repository at this point in the history
Enable buddy fields in group and entry edit pages
* Fixes #9060, you can now press Alt + [letter] to skip between fields on the group and entry edit pages.
* Move the expire checkbox to the right hand column and use the standard eye icon button for notes reveal. Only show notes reveal button if the hide notes setting is enabled.

Fix overflow of text in default auto-type sequence preview
* Fixes #9083

Add copy title shortcut (Ctrl + I)
* Closes #9109

Fix issues with menu actions being enabled incorrectly

Add accessibility description to password widget to explain how to hide/show passwords and open the generator
* Closes #9059

Add F6 shortcut to focus search
* Closes #9163
  • Loading branch information
droidmonkey committed Apr 16, 2023
1 parent 8077cd0 commit 6182b60
Show file tree
Hide file tree
Showing 6 changed files with 219 additions and 153 deletions.
44 changes: 22 additions & 22 deletions share/translations/keepassxc_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2895,84 +2895,80 @@ Would you like to correct it?</source>
<source>Notes field</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle the checkbox to reveal the notes section.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Username field</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle notes visible</source>
<source>Expiration field</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Notes:</source>
<source>Expiration Presets</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Expiration field</source>
<source>Expiration presets</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Expiration Presets</source>
<source>Presets</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Expiration presets</source>
<source>Url field</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Presets</source>
<source>Download favicon for URL</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Password:</source>
<source>Title field</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>URL:</source>
<source>Password field</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Url field</source>
<source>Toggle expiration</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Download favicon for URL</source>
<source>Tags list</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Title:</source>
<source>&amp;Username:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Title field</source>
<source>&amp;Title:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Username:</source>
<source>&amp;Password:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Password field</source>
<source>UR&amp;L:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle expiration</source>
<source>&amp;Notes:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Expires:</source>
<source>Toggle notes visibility</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Tags:</source>
<source>T&amp;ags:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Tags list</source>
<source>&amp;Expires:</source>
<translation type="unfinished"></translation>
</message>
</context>
Expand Down Expand Up @@ -6239,6 +6235,10 @@ Do you want to overwrite it?</source>
<comment>Password quality</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>Toggle password visibilty using Control + H. Open the password generator using Control + G.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PickcharsDialog</name>
Expand Down
9 changes: 6 additions & 3 deletions src/gui/EntryPreviewWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>508</width>
<width>530</width>
<height>257</height>
</rect>
</property>
Expand Down Expand Up @@ -177,7 +177,7 @@
<item>
<widget class="QTabWidget" name="entryTabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<property name="documentMode">
<bool>false</bool>
Expand Down Expand Up @@ -753,7 +753,7 @@
<string>Default Sequence</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
<set>Qt::AlignRight|Qt::AlignTop|Qt::AlignTrailing</set>
</property>
</widget>
</item>
Expand All @@ -771,6 +771,9 @@
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
Expand Down
36 changes: 24 additions & 12 deletions src/gui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ MainWindow::MainWindow()
m_entryContextMenu->addAction(m_ui->actionEntryOpenUrl);
m_entryContextMenu->addAction(m_ui->actionEntryDownloadIcon);
m_entryContextMenu->addSeparator();
m_entryContextMenu->addAction(m_ui->actionEntryAddToAgent);
m_entryContextMenu->addAction(m_ui->actionEntryRemoveFromAgent);
m_entryContextMenu->addSeparator();
m_entryContextMenu->addAction(m_ui->actionEntryRestore);

m_entryNewContextMenu = new QMenu(this);
Expand Down Expand Up @@ -192,18 +195,8 @@ MainWindow::MainWindow()
connect(sshAgent(), SIGNAL(error(QString)), this, SLOT(showErrorMessage(QString)));
connect(sshAgent(), SIGNAL(enabledChanged(bool)), this, SLOT(agentEnabled(bool)));
m_ui->settingsWidget->addSettingsPage(new AgentSettingsPage());

m_entryContextMenu->addSeparator();
m_entryContextMenu->addAction(m_ui->actionEntryAddToAgent);
m_entryContextMenu->addAction(m_ui->actionEntryRemoveFromAgent);

m_ui->actionEntryAddToAgent->setIcon(icons()->icon("utilities-terminal"));
m_ui->actionEntryRemoveFromAgent->setIcon(icons()->icon("utilities-terminal"));
#endif

m_ui->actionEntryAddToAgent->setVisible(false);
m_ui->actionEntryRemoveFromAgent->setVisible(false);

initViewMenu();

#if defined(WITH_XC_KEESHARE)
Expand Down Expand Up @@ -289,6 +282,7 @@ MainWindow::MainWindow()
m_ui->actionEntryMoveDown->setShortcut(Qt::CTRL + Qt::ALT + Qt::Key_Down);
m_ui->actionEntryCopyUsername->setShortcut(Qt::CTRL + Qt::Key_B);
m_ui->actionEntryCopyPassword->setShortcut(Qt::CTRL + Qt::Key_C);
m_ui->actionEntryCopyTitle->setShortcut(Qt::CTRL + Qt::Key_I);
m_ui->actionEntryAutoTypeSequence->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_V);
m_ui->actionEntryOpenUrl->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_U);
m_ui->actionEntryCopyURL->setShortcut(Qt::CTRL + Qt::Key_U);
Expand Down Expand Up @@ -322,6 +316,7 @@ MainWindow::MainWindow()
m_ui->actionEntryAutoTypeSequence->setShortcutVisibleInContextMenu(true);
m_ui->actionEntryOpenUrl->setShortcutVisibleInContextMenu(true);
m_ui->actionEntryCopyURL->setShortcutVisibleInContextMenu(true);
m_ui->actionEntryCopyTitle->setShortcutVisibleInContextMenu(true);
m_ui->actionEntryAddToAgent->setShortcutVisibleInContextMenu(true);
m_ui->actionEntryRemoveFromAgent->setShortcutVisibleInContextMenu(true);
#endif
Expand Down Expand Up @@ -416,6 +411,8 @@ MainWindow::MainWindow()
m_ui->actionEntryCopyPasswordTotp->setIcon(icons()->icon("totp-copy-password"));
m_ui->actionEntryTotpQRCode->setIcon(icons()->icon("qrcode"));
m_ui->actionEntrySetupTotp->setIcon(icons()->icon("totp-edit"));
m_ui->actionEntryAddToAgent->setIcon(icons()->icon("utilities-terminal"));
m_ui->actionEntryRemoveFromAgent->setIcon(icons()->icon("utilities-terminal"));
m_ui->menuTags->setIcon(icons()->icon("tag-multiple"));
m_ui->actionEntryDownloadIcon->setIcon(icons()->icon("favicon-download"));
m_ui->actionGroupSortAsc->setIcon(icons()->icon("sort-alphabetical-ascending"));
Expand Down Expand Up @@ -695,6 +692,7 @@ MainWindow::MainWindow()
statusBar()->addPermanentWidget(m_statusBarLabel);

restoreConfigState();
setMenuActionState();
}

MainWindow::~MainWindow()
Expand Down Expand Up @@ -885,6 +883,7 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
bool inWelcomeWidget = (currentIndex == WelcomeScreen);
bool inDatabaseTabWidgetOrWelcomeWidget = inDatabaseTabWidget || inWelcomeWidget;

m_ui->actionDatabaseClose->setEnabled(true);
m_ui->actionDatabaseMerge->setEnabled(inDatabaseTabWidget);
m_ui->actionDatabaseNew->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
m_ui->actionDatabaseOpen->setEnabled(inDatabaseTabWidgetOrWelcomeWidget);
Expand Down Expand Up @@ -1042,14 +1041,20 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
// Only disable the action in the database menu so that the
// menu remains active in the toolbar, if necessary
m_ui->actionLockDatabase->setEnabled(false);
// Never show in these modes
m_ui->actionEntryMoveUp->setVisible(false);
m_ui->actionEntryMoveDown->setVisible(false);
m_ui->actionEntryRestore->setVisible(false);
m_ui->actionEntryAddToAgent->setVisible(false);
m_ui->actionEntryRemoveFromAgent->setVisible(false);
m_ui->actionGroupEmptyRecycleBin->setVisible(false);

m_searchWidgetAction->setEnabled(false);
break;
}
default:
Q_ASSERT(false);
}
m_ui->actionDatabaseClose->setEnabled(true);
} else {
const auto entryActions = m_ui->menuEntries->actions();
for (auto action : entryActions) {
Expand All @@ -1072,6 +1077,13 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode)
m_ui->actionExportCsv->setEnabled(false);
m_ui->actionExportHtml->setEnabled(false);
m_ui->actionDatabaseMerge->setEnabled(false);
// Hide entry-specific actions
m_ui->actionEntryMoveUp->setVisible(false);
m_ui->actionEntryMoveDown->setVisible(false);
m_ui->actionEntryRestore->setVisible(false);
m_ui->actionEntryAddToAgent->setVisible(false);
m_ui->actionEntryRemoveFromAgent->setVisible(false);
m_ui->actionGroupEmptyRecycleBin->setVisible(false);

m_searchWidgetAction->setEnabled(false);
}
Expand Down Expand Up @@ -1415,7 +1427,7 @@ void MainWindow::keyPressEvent(QKeyEvent* event)
} else if (event->key() == Qt::Key_F2) {
dbWidget->focusOnEntries(true);
return;
} else if (event->key() == Qt::Key_F3) {
} else if (event->key() == Qt::Key_F3 || event->key() == Qt::Key_F6) {
focusSearchWidget();
return;
} else if (event->key() == Qt::Key_Escape && dbWidget->isSearchActive()) {
Expand Down
6 changes: 5 additions & 1 deletion src/gui/PasswordWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
<number>0</number>
</property>
<item>
<widget class="QLineEdit" name="passwordEdit"/>
<widget class="QLineEdit" name="passwordEdit">
<property name="accessibleDescription">
<string>Toggle password visibilty using Control + H. Open the password generator using Control + G.</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="qualityProgressBar">
Expand Down
8 changes: 4 additions & 4 deletions src/gui/entry/EditEntryWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void EditEntryWidget::setupMain()
}
});

connect(m_mainUi->notesEnabled, SIGNAL(toggled(bool)), this, SLOT(toggleHideNotes(bool)));
connect(m_mainUi->revealNotesButton, &QToolButton::clicked, this, &EditEntryWidget::toggleHideNotes);

m_mainUi->expirePresets->setMenu(createPresetsMenu());
connect(m_mainUi->expirePresets->menu(), SIGNAL(triggered(QAction*)), this, SLOT(useExpiryPreset(QAction*)));
Expand Down Expand Up @@ -800,7 +800,7 @@ void EditEntryWidget::useExpiryPreset(QAction* action)
void EditEntryWidget::toggleHideNotes(bool visible)
{
m_mainUi->notesEdit->setVisible(visible);
m_mainUi->notesHint->setVisible(!visible);
m_mainUi->revealNotesButton->setIcon(icons()->onOffIcon("password-show", visible));
}

Entry* EditEntryWidget::currentEntry() const
Expand Down Expand Up @@ -859,10 +859,10 @@ void EditEntryWidget::setForms(Entry* entry, bool restore)
m_mainUi->tagsList->completion(m_db->tagList());
m_mainUi->expireCheck->setEnabled(!m_history);
m_mainUi->expireDatePicker->setReadOnly(m_history);
m_mainUi->notesEnabled->setChecked(!config()->get(Config::Security_HideNotes).toBool());
m_mainUi->revealNotesButton->setIcon(icons()->onOffIcon("password-show", false));
m_mainUi->revealNotesButton->setVisible(config()->get(Config::Security_HideNotes).toBool());
m_mainUi->notesEdit->setReadOnly(m_history);
m_mainUi->notesEdit->setVisible(!config()->get(Config::Security_HideNotes).toBool());
m_mainUi->notesHint->setVisible(config()->get(Config::Security_HideNotes).toBool());
if (config()->get(Config::GUI_MonospaceNotes).toBool()) {
m_mainUi->notesEdit->setFont(Font::fixedFont());
} else {
Expand Down
Loading

0 comments on commit 6182b60

Please sign in to comment.