Commit ee49bfc0 authored by Matthieu Gallien's avatar Matthieu Gallien 🎵

improve accessibility by providing metadata for UI elements

Summary: Add metadata while preserving the string freeze to help a screen reader when navigating with keyboard

Test Plan: Tested under plasma with orca

Reviewers: #elisa, #plasma_accessibility, chempfling, ngraham

Reviewed By: #elisa, #plasma_accessibility, chempfling, ngraham

Subscribers: lavender, davidedmundson, ngraham

Differential Revision: https://phabricator.kde.org/D21608
parent 00b32e06
......@@ -79,6 +79,8 @@ Item {
ToolButton {
iconName: 'list-remove'
Accessible.onPressAction: onClicked
anchors.top: parent.top
anchors.right: parent.right
......@@ -129,6 +131,8 @@ Item {
text: i18n("Add new path")
onClicked: fileDialog.open()
Accessible.onPressAction: onClicked
Layout.alignment: Qt.AlignTop | Qt.AlignLeft
FileDialog {
......
......@@ -37,6 +37,9 @@ FocusScope {
focus: true
Accessible.role: Accessible.Pane
Accessible.name: mainTitle
DataModel {
id: realModel
}
......
......@@ -40,6 +40,9 @@ ApplicationWindow {
title: i18n("Elisa")
Accessible.role: Accessible.Application
Accessible.name: title
property var goBackAction: elisa.action("go_back")
property var seekAction: elisa.action("Seek")
property var scrubAction: elisa.action("Scrub")
......
......@@ -53,6 +53,9 @@ FocusScope {
Keys.onReturnPressed: gridEntry.enqueue(fileUrl)
Keys.onEnterPressed: gridEntry.enqueue(fileUrl)
Accessible.role: Accessible.ListItem
Accessible.name: fileName
Rectangle {
id: stateIndicator
......@@ -140,6 +143,9 @@ FocusScope {
metadataLoader.active = false
}
}
Accessible.onPressAction: onClicked
ToolTip {
text: i18nc("Show track metadata", "View Details")
}
......@@ -159,6 +165,9 @@ FocusScope {
onClicked: isDirectory ?
open(fileUrl) :
enqueue(fileUrl)
Accessible.onPressAction: onClicked
ToolTip {
text: isDirectory ?
i18nc("Open view of the container", "Open") :
......@@ -177,6 +186,9 @@ FocusScope {
icon.name: "media-playback-start"
onClicked: replaceAndPlay(fileUrl)
Accessible.onPressAction: onClicked
ToolTip {
text: i18nc("Clear play list and enqueue current track", "Play Now and Replace Play List")
}
......
......@@ -114,6 +114,9 @@ FocusScope {
currentIndex: -1
Accessible.role: Accessible.List
Accessible.name: proxyModel.url
model: proxyModel
ScrollHelper {
......
......@@ -48,6 +48,8 @@ Button {
border.width: 1
}
Accessible.onPressAction: onClicked
ToolTip.visible: hovered
ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
ToolTip.text: flatButtonWithToolTip.action.text
......
......@@ -43,6 +43,9 @@ FocusScope {
Keys.onReturnPressed: open()
Keys.onEnterPressed: open()
Accessible.role: Accessible.ListItem
Accessible.name: mainText
Rectangle {
id: stateIndicator
......@@ -132,6 +135,11 @@ FocusScope {
ToolTip.delay: 1000
ToolTip.text: i18nc("Clear play list and add whole container to play list", "Play now, replacing current playlist")
Accessible.role: Accessible.Button
Accessible.name: ToolTip.text
Accessible.description: ToolTip.text
Accessible.onPressAction: onClicked
onClicked: replaceAndPlay(databaseId, mainText)
Keys.onReturnPressed: replaceAndPlay(databaseId, mainText)
Keys.onEnterPressed: replaceAndPlay(databaseId, mainText)
......@@ -153,6 +161,11 @@ FocusScope {
ToolTip.delay: 1000
ToolTip.text: i18nc("Add whole container to play list", "Add to playlist")
Accessible.role: Accessible.Button
Accessible.name: ToolTip.text
Accessible.description: ToolTip.text
Accessible.onPressAction: onClicked
onClicked: enqueue(databaseId, mainText)
Keys.onReturnPressed: enqueue(databaseId, mainText)
Keys.onEnterPressed: enqueue(databaseId, mainText)
......@@ -173,6 +186,11 @@ FocusScope {
ToolTip.delay: 1000
ToolTip.text: i18nc("Open view of the container", "Open")
Accessible.role: Accessible.Button
Accessible.name: ToolTip.text
Accessible.description: ToolTip.text
Accessible.onPressAction: onClicked
onClicked: open()
width: elisaTheme.delegateToolButtonSize
......
......@@ -114,6 +114,9 @@ FocusScope {
currentIndex: -1
Accessible.role: Accessible.List
Accessible.name: mainTitle
TextMetrics {
id: secondaryLabelSize
text: 'example'
......
......@@ -105,6 +105,10 @@ FocusScope {
anchors.topMargin: 20
anchors.fill: parent
Accessible.role: Accessible.List
Accessible.name: mainTitle
Accessible.description: mainTitle
activeFocusOnTab: true
keyNavigationEnabled: true
......
......@@ -38,6 +38,10 @@ FocusScope {
property alias isSelected: mediaTrack.isSelected
property alias isAlternateColor: mediaTrack.isAlternateColor
Accessible.role: Accessible.ListItem
Accessible.name: title
Accessible.description: title
ColumnLayout {
anchors.fill: parent
......
......@@ -36,6 +36,9 @@ FocusScope {
id: topItem
Accessible.role: Accessible.Pane
Accessible.name: viewTitleHeight.text
Controls1.Action {
id: clearPlayList
text: i18nc("Remove all tracks from play list", "Clear Playlist")
......@@ -123,18 +126,22 @@ FocusScope {
Controls1.ToolButton {
action: showCurrentTrack
Keys.onReturnPressed: action.trigger()
Accessible.onPressAction: action.trigger()
},
Controls1.ToolButton {
action: savePlaylist
Keys.onReturnPressed: action.trigger()
Accessible.onPressAction: action.trigger()
},
Controls1.ToolButton {
action: loadPlaylist
Keys.onReturnPressed: action.trigger()
Accessible.onPressAction: action.trigger()
},
Controls1.ToolButton {
action: clearPlayList
Keys.onReturnPressed: action.trigger()
Accessible.onPressAction: action.trigger()
}
]
}
......@@ -213,6 +220,7 @@ FocusScope {
Layout.fillWidth: true
Layout.fillHeight: true
title: viewTitleHeight.text
playListModel: elisa.mediaPlayList
focus: true
......
......@@ -47,6 +47,10 @@ FocusScope {
signal enqueue(var databaseId, var name)
signal replaceAndPlay(var databaseId, var name)
Accessible.role: Accessible.ListItem
Accessible.name: title
Accessible.description: title
Controls1.Action {
id: enqueueAction
text: i18nc("Enqueue current track", "Enqueue")
......@@ -295,6 +299,7 @@ FocusScope {
width: elisaTheme.delegateHeight
action: viewDetailsAction
Accessible.onPressAction: action.trigger()
}
Controls1.ToolButton {
......@@ -304,6 +309,7 @@ FocusScope {
width: elisaTheme.delegateHeight
action: enqueueAction
Accessible.onPressAction: action.trigger()
}
Controls1.ToolButton {
......@@ -315,6 +321,7 @@ FocusScope {
width: elisaTheme.delegateHeight
action: replaceAndPlayAction
Accessible.onPressAction: action.trigger()
}
}
}
......
......@@ -90,6 +90,7 @@ ColumnLayout {
objectName: 'goPreviousButton'
Keys.onReturnPressed: action.trigger()
Accessible.onPressAction: action.trigger()
activeFocusOnTab: true
focus: enableGoBack
......@@ -190,6 +191,7 @@ ColumnLayout {
onClicked: enqueue()
Keys.onReturnPressed: enqueue()
Accessible.onPressAction: onClicked
Layout.leftMargin: 0
Layout.rightMargin: 0
......@@ -205,6 +207,7 @@ ColumnLayout {
onClicked: replaceAndPlay()
Keys.onReturnPressed: replaceAndPlay()
Accessible.onPressAction: onClicked
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
......@@ -221,7 +224,8 @@ ColumnLayout {
activeFocusOnTab: true
onClicked: showArtist()
Keys.onReturnPressed: showArtist()
Keys.onReturnPressed: onClicked
Accessible.onPressAction: onClicked
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
Layout.rightMargin: LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
......@@ -238,6 +242,7 @@ ColumnLayout {
activeFocusOnTab: true
Keys.onReturnPressed: action.trigger()
Accessible.onPressAction: action.trigger()
Layout.alignment: Qt.AlignRight
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
......@@ -281,6 +286,8 @@ ColumnLayout {
horizontalAlignment: TextInput.AlignLeft
Accessible.role: Accessible.EditableText
placeholderText: i18nc("Placeholder text in the filter text box", "Album name, artist, etc.")
Layout.bottomMargin: 0
......@@ -363,6 +370,7 @@ ColumnLayout {
activeFocusOnTab: true
Keys.onReturnPressed: action.trigger()
Accessible.onPressAction: action.trigger()
Layout.alignment: Qt.AlignRight
Layout.leftMargin: !LayoutMirroring.enabled ? elisaTheme.layoutHorizontalMargin : 0
......
......@@ -137,6 +137,7 @@ MouseArea {
callBack();
}
}
Accessible.onPressAction: onClicked
}
}
layer.enabled: true
......
......@@ -25,6 +25,7 @@ ListView {
id: playListView
property alias playListModel: playListModelDelegate.model
property string title
signal startPlayback()
signal pausePlayback()
......@@ -36,6 +37,9 @@ ListView {
currentIndex: -1
Accessible.role: Accessible.List
Accessible.name: title
section.property: 'albumSection'
section.criteria: ViewSection.FullString
section.labelPositioning: ViewSection.InlineLabels
......
......@@ -53,6 +53,9 @@ FocusScope {
signal removeFromPlaylist(var trackIndex)
signal switchToTrack(var trackIndex)
Accessible.role: Accessible.ListItem
Accessible.name: title + ' ' + album + ' ' + artist
height: elisaTheme.playListDelegateHeight
Controls1.Action {
......@@ -340,6 +343,8 @@ FocusScope {
visible: opacity > 0.1
action: showInfo
Accessible.onPressAction: action.trigger()
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
}
......@@ -356,6 +361,8 @@ FocusScope {
visible: opacity > 0.1
action: !(isPlaying === MediaPlayList.IsPlaying) ? playNow : pauseNow
Accessible.onPressAction: action.trigger()
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
}
......@@ -376,6 +383,7 @@ FocusScope {
visible: opacity > 0.1
action: removeFromPlayList
Accessible.onPressAction: action.trigger()
}
}
......
......@@ -79,6 +79,7 @@ FocusScope {
text: manager.countNotifications
onClicked: topItem.isViewExpanded = !topItem.isViewExpanded
Accessible.onPressAction: onClicked
}
}
......
......@@ -75,6 +75,7 @@ FocusScope {
enableAgainMainButtonTimer.start()
mainButtonClicked()
}
Accessible.onPressAction: onClicked
Timer {
id: enableAgainMainButtonTimer
......@@ -98,6 +99,7 @@ FocusScope {
enableAgainSecondaryButtonTimer.start()
secondaryButtonClicked()
}
Accessible.onPressAction: onClicked
Timer {
id: enableAgainSecondaryButtonTimer
......@@ -121,5 +123,6 @@ FocusScope {
iconName: 'dialog-close'
onClicked: close()
Accessible.onPressAction: onClicked
}
}
......@@ -65,6 +65,8 @@ FocusScope {
ListView {
id: viewModeView
Accessible.role: Accessible.List
focus: true
activeFocusOnTab: true
keyNavigationEnabled: true
......
......@@ -36,6 +36,10 @@ FocusScope {
color: "transparent"
}
Accessible.role: Accessible.ListItem
Accessible.description: model.display
Accessible.name: model.display
MouseArea {
id: hoverArea
......
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