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

[a11y] Move server URL from status label to Account button #11810

Merged
merged 1 commit into from
Aug 30, 2024
Merged
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
[a11y] Move server URL from status label to Account button
The URL in the status label of the account settings page was not
always accessible by keyboard. The label will now only show the
connection status, and the "Manage Account" button has a new entry
for "Open in Web Browser".

Fixes: #11800
Fixes: #11772
erikjv committed Aug 29, 2024
commit 64d9f1202072a6316a57dcafd2e13ce23b0ada16
11 changes: 11 additions & 0 deletions changelog/unreleased/11810
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Bugfix: Make open account in browser accessible for keyboard navigation

On the account settings page, the status label contained the URL of the
server. This URL was not accessible with keyboard navigation or when a
screen-reader was used. Now there is an "Open in Web Browser" action in
the pop-up menu of the "Manage Account" button (which is next to the
status label), and the URL has been removed from the status label.

https://github.com/owncloud/client/issues/11772
https://github.com/owncloud/client/issues/11800
https://github.com/owncloud/client/pull/11810
45 changes: 19 additions & 26 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
@@ -81,20 +81,21 @@ AccountSettings::AccountSettings(const AccountStatePtr &accountState, QWidget *p
connect(accountsState()->account()->spacesManager(), &GraphApi::SpacesManager::updated, this, &AccountSettings::slotSpacesUpdated);
}

ui->connectLabel->clear();
ui->connectionStatusLabel->clear();

connect(_accountState.data(), &AccountState::stateChanged, this, &AccountSettings::slotAccountStateChanged);
slotAccountStateChanged();

connect(ui->accountToolButton, &QToolButton::clicked, this, [this] {
connect(ui->manageAccountButton, &QToolButton::clicked, this, [this] {
QMenu *menu = new QMenu(this);
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->setAccessibleName(tr("Account options menu"));
menu->addAction(_accountState->isSignedOut() ? tr("Log in") : tr("Log out"), this, &AccountSettings::slotToggleSignInState);
auto *reconnectAction = menu->addAction(tr("Reconnect"), this, [this] { _accountState->checkConnectivity(true); });
reconnectAction->setEnabled(!_accountState->isConnected() && !_accountState->isSignedOut());
menu->addAction(CommonStrings::showInWebBrowser(), this, [this] { QDesktopServices::openUrl(_accountState->account()->url()); });
menu->addAction(tr("Remove"), this, &AccountSettings::slotDeleteAccount);
menu->popup(mapToGlobal(ui->accountToolButton->pos()));
menu->popup(mapToGlobal(ui->manageAccountButton->pos()));

// set the focus for accessability
menu->setFocus();
@@ -110,7 +111,7 @@ AccountSettings::AccountSettings(const AccountStatePtr &accountState, QWidget *p
}
});
connect(ui->stackedWidget, &QStackedWidget::currentChanged, this,
[this] { ui->accountToolButton->setEnabled(ui->stackedWidget->currentWidget() == ui->quickWidget); });
[this] { ui->manageAccountButton->setEnabled(ui->stackedWidget->currentWidget() == ui->quickWidget); });
ui->stackedWidget->setCurrentWidget(ui->quickWidget);
}

@@ -349,14 +350,14 @@ void AccountSettings::slotDisableVfsCurrentFolder(Folder *folder)
void AccountSettings::showConnectionLabel(const QString &message, QStringList errors)
{
if (errors.isEmpty()) {
ui->connectLabel->setText(message);
ui->connectLabel->setToolTip(QString());
ui->connectionStatusLabel->setText(message);
ui->connectionStatusLabel->setToolTip(QString());
} else {
errors.prepend(message);
const QString msg = errors.join(QLatin1String("\n"));
qCDebug(lcAccountSettings) << msg;
ui->connectLabel->setText(msg);
ui->connectLabel->setToolTip(QString());
ui->connectionStatusLabel->setText(msg);
ui->connectionStatusLabel->setToolTip(QString());
}
ui->accountStatus->setVisible(!message.isEmpty());
ui->warningLabel->setVisible(!errors.isEmpty());
@@ -451,58 +452,50 @@ void AccountSettings::slotAccountStateChanged()
const AccountPtr account = _accountState->account();
qCDebug(lcAccountSettings) << "Account state changed to" << state << "for account" << account;

// in 2023 there should never be credentials encoded in the url, but we never know...
const auto safeUrl = account->url().adjusted(QUrl::RemoveUserInfo);

FolderMan *folderMan = FolderMan::instance();
for (auto *folder : folderMan->folders()) {
_model->slotUpdateFolderState(folder);
}

const QString server = QStringLiteral("<a href=\"%1\">%1</a>")
.arg(Utility::escape(safeUrl.toString()));

switch (state) {
case AccountState::Connected: {
QStringList errors;
if (account->serverSupportLevel() != Account::ServerSupportLevel::Supported) {
errors << tr("The server version %1 is unsupported! Proceed at your own risk.").arg(account->capabilities().status().versionString());
}
showConnectionLabel(tr("Connected to %1.").arg(server), errors);
showConnectionLabel(tr("Connected"), errors);
break;
}
case AccountState::ServiceUnavailable:
showConnectionLabel(tr("Server %1 is temporarily unavailable.").arg(server));
showConnectionLabel(tr("Server is temporarily unavailable"));
break;
case AccountState::MaintenanceMode:
showConnectionLabel(tr("Server %1 is currently in maintenance mode.").arg(server));
showConnectionLabel(tr("Server is currently in maintenance mode"));
break;
case AccountState::SignedOut:
showConnectionLabel(tr("Signed out from %1.").arg(server));
showConnectionLabel(tr("Signed out"));
break;
case AccountState::AskingCredentials: {
showConnectionLabel(tr("Updating credentials for %1...").arg(server));
showConnectionLabel(tr("Updating credentials..."));
break;
}
case AccountState::Connecting:
if (NetworkInformation::instance()->isBehindCaptivePortal()) {
showConnectionLabel(tr("Captive portal prevents connections to %1.").arg(server));
showConnectionLabel(tr("Captive portal prevents connections to the server."));
} else if (NetworkInformation::instance()->isMetered() && ConfigFile().pauseSyncWhenMetered()) {
showConnectionLabel(tr("Sync to %1 is paused due to metered internet connection.").arg(server));
showConnectionLabel(tr("Sync is paused due to metered internet connection"));
} else {
showConnectionLabel(tr("Connecting to: %1.").arg(server));
showConnectionLabel(tr("Connecting..."));
}
break;
case AccountState::ConfigurationError:
showConnectionLabel(tr("Server configuration error: %1.")
.arg(server),
_accountState->connectionErrors());
showConnectionLabel(tr("Server configuration error"), _accountState->connectionErrors());
break;
case AccountState::NetworkError:
// don't display the error to the user, https://github.com/owncloud/client/issues/9790
[[fallthrough]];
case AccountState::Disconnected:
showConnectionLabel(tr("Disconnected from: %1.").arg(server));
showConnectionLabel(tr("Disconnected"));
break;
}
}
25 changes: 5 additions & 20 deletions src/gui/accountsettings.ui
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@
<string/>
</property>
<property name="textFormat">
<enum>Qt::TextFormat::AutoText</enum>
<enum>Qt::PlainText</enum>
</property>
<property name="pixmap">
<pixmap resource="../resources/client.qrc">:/client/resources/light/warning.svg</pixmap>
@@ -55,32 +55,26 @@
</widget>
</item>
<item>
<widget class="QLabel" name="connectLabel">
<widget class="QLabel" name="connectionStatusLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Connected with &lt;server&gt; as &lt;user&gt;</string>
<string notr="true">Connection Status</string>
</property>
<property name="textFormat">
<enum>Qt::TextFormat::RichText</enum>
<enum>Qt::PlainText</enum>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
<property name="textInteractionFlags">
<set>Qt::TextBrowserInteraction</set>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="accountToolButton">
<widget class="QToolButton" name="manageAccountButton">
<property name="text">
<string>Manage Account</string>
</property>
@@ -104,9 +98,6 @@
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
@@ -120,9 +111,6 @@
<property name="text">
<string>Preparing the account</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item>
@@ -134,9 +122,6 @@
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
Loading