Skip to content

KeySequenceItem: be Accessible.Button, not Checkbox

Christoph Wolk requested to merge cwo/kdeclarative:keysequenceitem_button into master

KeySequenceItem is visually a button, and derives from the QtQuick.Controls type Button. It has some checkbox-like properties though, including a checked property for internal use, and QtQuick identifies it as a checkbox. This has two negative a11y consequences: first, it is confusing that something that is semantically an action (recording a keyboard shortcut sequence) is announced as a control that represents boolean state to users that can't see it. Second, the internal use of checked toggles it more than once during regular operation (to record whether recording is in progress) and so the user is exposed to multiple unnecessary announcements of "checked" "not checked".

This change explicitly sets the role Accessible.Button explicitly, solving this problem for all direct uses of KeySequenceItem.

Small test case:

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as Controls
import org.kde.kirigami as Kirigami
import org.kde.kquickcontrols as KQuickControls

Kirigami.ApplicationWindow {
    id: root

    width: 400
    height: 300

    title: i18nc("@title:window", "KeySequenceItem Test")

    pageStack.initialPage: Kirigami.Page {
        Controls.Label {
            anchors.centerIn: parent
            KQuickControls.KeySequenceItem {
                id: keySequenceItem
                Accessible.name: "test"
            }
        }
    }
}

Problem in action: its_a_checkbox

Solution in action: its_a_button

@teams/accessibility

Edited by Christoph Wolk

Merge request reports