Files
metabuilder/qml/MetaBuilder/CComponentTreeRow.qml
johndoe6345789 d9ca84628b feat(a11y): deep keyboard accessibility pass across all QML components
Second-pass a11y work across all 12 component groups. Every interactive
element now has activeFocusOnTab, Keys.onReturnPressed/SpacePressed, and
context-aware Accessible.name/description bindings.

Highlights:
- Dialogs: keyboard handlers with enabled-guard on confirm buttons
- CDropdownMenu: full keyboard nav (Up/Down/Enter/Escape)
- CLoginForm: explicit KeyNavigation.tab chain (username→password→submit)
- CNotificationBell: dynamic "3 notifications"/"No notifications" name
- CJobProgressBar: Accessible.minimumValue/maximumValue/currentValue
- CExecutionStatusDot: "Execution status: Running/Passed/Failed" binding
- CKeyboardShortcuts: invisible Repeater exposes all shortcuts to a11y tree
- CDataTable rows: "Row N of M" descriptions
- Canvas elements: Accessible.Canvas role + keyboard zoom (+/- keys)
- DropdownExpandedList: focus-highlight extended to :activeFocus
- Dynamic names reflect loading state (e.g. "Signing in, please wait")

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-19 20:53:53 +00:00

89 lines
2.3 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QmlComponents 1.0
Rectangle {
id: root
objectName: "row_component_tree"
Accessible.role: Accessible.ListItem
Accessible.name: node ? node.name : ""
Accessible.description: node
? node.type + ", depth "
+ node.depth
+ (childCount > 0
? ", " + childCount + " children"
: "")
: ""
activeFocusOnTab: true
Keys.onReturnPressed: root.clicked()
Keys.onSpacePressed: root.clicked()
property var node
property bool isSelected: false
property int childCount: 0
signal clicked()
width: parent ? parent.width : 400
height: 40
radius: 6
color: isSelected
? Qt.rgba(Theme.primary.r, Theme.primary.g, Theme.primary.b, 0.12)
: mouseArea.containsMouse ? Theme.surface : "transparent"
function typeBadgeColor(nodeType) {
switch (nodeType) {
case "container": return "#5C6BC0"
case "layout": return "#26A69A"
case "widget": return "#FFA726"
case "atom": return "#EF5350"
default: return Theme.primary
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: root.clicked()
}
RowLayout {
anchors.fill: parent
anchors.leftMargin: 12 + (root.node ? root.node.depth * 24 : 0)
anchors.rightMargin: 12
spacing: 8
CText {
visible: root.node && root.node.depth > 0
variant: "caption"
text: "\u251C\u2500"
opacity: 0.4
}
Rectangle {
width: 8; height: 8; radius: 4
color: root.node ? typeBadgeColor(root.node.type) : "#9e9e9e"
}
CText {
variant: root.isSelected ? "body1" : "body2"
text: root.node ? root.node.name : ""
Layout.fillWidth: true
}
CText {
variant: "caption"
text: root.node && root.node.visible ? "\uD83D\uDC41" : "\u2014"
opacity: root.node && root.node.visible ? 0.6 : 0.3
}
CBadge {
visible: root.childCount > 0
text: root.childCount.toString()
}
}
}