Skip to content

Commit

Permalink
FIX(a11y): Make search result tree accessible
Browse files Browse the repository at this point in the history
  • Loading branch information
Hartmnt committed Jan 6, 2024
1 parent fdb4a26 commit 8d3319b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/mumble/SearchDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#include "Accessibility.h"
#include "SearchDialog.h"
#include "Channel.h"
#include "ClientUser.h"
Expand All @@ -26,6 +27,8 @@

#include <stack>

#include <QDebug>

namespace Search {

QString SearchDialog::toString(UserAction action) {
Expand Down Expand Up @@ -226,13 +229,37 @@ void SearchDialog::on_searchResultTree_currentItemChanged(QTreeWidgetItem *c, QT
if (user) {
// Only try to select the user if (s)he still exists
Global::get().mw->pmModel->setSelectedUser(user->uiSession);
item.setData(0, Qt::AccessibleTextRole, Mumble::Accessibility::userToText(user));
item.setData(1, Qt::AccessibleTextRole, Mumble::Accessibility::userToText(user));
item.setData(0, Qt::AccessibleDescriptionRole, Mumble::Accessibility::userToText(user));
item.setData(1, Qt::AccessibleDescriptionRole, Mumble::Accessibility::userToText(user));
item.setToolTip(0, Mumble::Accessibility::userToText(user));
item.setToolTip(1, Mumble::Accessibility::userToText(user));
qDebug() << Mumble::Accessibility::userToText(user);
qDebug() << searchResultTree->allColumnsShowFocus(); // false
qDebug() << searchResultTree->focusPolicy(); // strong focus
qDebug() << searchResultTree->hasFocus(); // true
qDebug() << searchResultTree->tabKeyNavigation(); // false
// searchResultTree->updateMicroFocus
}
} else {
const Channel *channel = Channel::get(static_cast< int >(item.getID()));

if (channel) {
// Only try to select the channel if it still exists
Global::get().mw->pmModel->setSelectedChannel(channel->iId);
item.setData(0, Qt::AccessibleTextRole, Mumble::Accessibility::channelToText(channel));
item.setData(1, Qt::AccessibleTextRole, Mumble::Accessibility::channelToText(channel));
item.setData(0, Qt::AccessibleDescriptionRole, Mumble::Accessibility::channelToText(channel));
item.setData(1, Qt::AccessibleDescriptionRole, Mumble::Accessibility::channelToText(channel));
item.setToolTip(0, Mumble::Accessibility::channelToText(channel));
item.setToolTip(1, Mumble::Accessibility::channelToText(channel));
qDebug() << Mumble::Accessibility::channelToText(channel);
qDebug() << searchResultTree->allColumnsShowFocus();
qDebug() << searchResultTree->focusPolicy();
qDebug() << searchResultTree->hasFocus();
qDebug() << searchResultTree->tabKeyNavigation();
// searchResultTree->updateMicroFocus
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/mumble/SearchDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@
</item>
<item row="2" column="0" colspan="2">
<widget class="SearchDialogTree" name="searchResultTree">
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="accessibleName">
<string>Search results</string>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<column>
<property name="text">
<string/>
Expand Down

0 comments on commit 8d3319b

Please sign in to comment.