Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 5946e684 authored by Marco Martin's avatar Marco Martin

make krunner accessible

Summary:
this is the milou part: refine keyboard navigation and
semantically mark the entries with the correct text
to be read by orca

Test Plan: tested keyboard navigation and made sure orca reads the correct meaningful text

Reviewers: #plasma, davidedmundson, broulik

Reviewed By: #plasma, davidedmundson

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D7766
parent 4557c0a5
......@@ -45,6 +45,9 @@ MouseArea {
property string typeText: sectionHasChanged ? ListView.section : ""
property var additionalActions: typeof actions !== "undefined" ? actions : []
Accessible.role: Accessible.ListItem
Accessible.name: displayLabel.text
Accessible.description: subtextLabel.text.length > 0 ? i18nd("milou", "%1, in category %2", subtextLabel.text, ListView.section) : i18nd("milou", "in category %1", ListView.section)
property bool __pressed: false
property int __pressX: -1
property int __pressY: -1
......@@ -234,12 +237,15 @@ MouseArea {
tooltip: {
var text = modelData.text || ""
if (index === 0) { // Shift+Return will invoke first action
text = i18nc("placeholder is action e.g. run in terminal, in parenthesis is shortcut", "%1 (Shift+Return)", text)
text = i18ncd("milou", "placeholder is action e.g. run in terminal, in parenthesis is shortcut", "%1 (Shift+Return)", text)
}
return text
}
Accessible.role: Accessible.Button
Accessible.name: modelData.text
checkable: checked
checked: resultDelegate.activeAction === index
focus: resultDelegate.activeAction === index
PlasmaCore.IconItem {
anchors.centerIn: parent
......
......@@ -41,6 +41,8 @@ ListView {
keyNavigationWraps: true
highlight: PlasmaComponents.Highlight {}
highlightMoveDuration: 0
activeFocusOnTab: true
Accessible.role: Accessible.List
section {
criteria: ViewSection.FullString
......@@ -126,11 +128,25 @@ ListView {
}
}
onActiveFocusChanged: {
if (!activeFocus && currentIndex == listView.count-1) {
currentIndex = 0;
}
}
Keys.onTabPressed: {
if (!currentItem || !currentItem.activateNextAction()) {
if (reversed) {
if (currentIndex == 0) {
listView.nextItemInFocusChain(false).forceActiveFocus();
return;
}
decrementCurrentIndex()
} else {
if (currentIndex == listView.count-1) {
listView.nextItemInFocusChain(true).forceActiveFocus();
return;
}
incrementCurrentIndex()
}
}
......@@ -138,8 +154,16 @@ ListView {
Keys.onBacktabPressed: {
if (!currentItem || !currentItem.activatePreviousAction()) {
if (reversed) {
if (currentIndex == listView.count-1) {
listView.nextItemInFocusChain(true).forceActiveFocus();
return;
}
incrementCurrentIndex()
} else {
if (currentIndex == 0) {
listView.nextItemInFocusChain(false).forceActiveFocus();
return;
}
decrementCurrentIndex()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment