mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 14:25:02 +00:00
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>
127 lines
3.6 KiB
QML
127 lines
3.6 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import QmlComponents 1.0
|
|
|
|
CPaper {
|
|
id: root
|
|
objectName: "dropdownPreview"
|
|
Accessible.role: Accessible.Pane
|
|
Accessible.name: "Dropdown preview"
|
|
property var dropdown: null
|
|
implicitHeight: previewColumn.implicitHeight + 32
|
|
|
|
ColumnLayout {
|
|
id: previewColumn
|
|
anchors.fill: parent
|
|
anchors.margins: 16
|
|
spacing: 12
|
|
|
|
CText {
|
|
variant: "caption"
|
|
text: "This is how the dropdown will"
|
|
+ " render in forms:"
|
|
color: Theme.text; opacity: 0.6
|
|
}
|
|
|
|
ColumnLayout {
|
|
Layout.fillWidth: true
|
|
spacing: 4
|
|
|
|
CText {
|
|
variant: "body2"
|
|
text: (root.dropdown
|
|
? root.dropdown.name : "")
|
|
+ (root.dropdown
|
|
&& root.dropdown.required
|
|
? " *" : "")
|
|
font.bold: true
|
|
}
|
|
|
|
Rectangle {
|
|
Layout.fillWidth: true
|
|
Layout.preferredHeight: 40
|
|
color: Theme.surface
|
|
border.color: Theme.border
|
|
border.width: 1
|
|
radius: 4
|
|
activeFocusOnTab: true
|
|
Accessible.role: Accessible.ComboBox
|
|
Accessible.name: root.dropdown
|
|
? root.dropdown.name : "Dropdown"
|
|
Accessible.description: root.dropdown
|
|
? root.dropdown.description : ""
|
|
|
|
RowLayout {
|
|
anchors.fill: parent
|
|
anchors.leftMargin: 12
|
|
anchors.rightMargin: 12
|
|
spacing: 8
|
|
|
|
CText {
|
|
variant: "body1"
|
|
text: root.dropdown && root.dropdown.options.length > 0
|
|
? root.dropdown.options[0].label
|
|
: "No options"
|
|
Layout.fillWidth: true
|
|
color: Theme.text
|
|
}
|
|
CText {
|
|
variant: "body2"
|
|
text: "\u25BE"
|
|
color: Theme.text
|
|
opacity: 0.5
|
|
}
|
|
}
|
|
}
|
|
|
|
CText {
|
|
variant: "caption"
|
|
text: root.dropdown ? root.dropdown.description : ""
|
|
color: Theme.text
|
|
opacity: 0.5
|
|
}
|
|
}
|
|
|
|
CDivider { Layout.fillWidth: true }
|
|
|
|
CText {
|
|
variant: "caption"
|
|
text: "Expanded view:"
|
|
color: Theme.text
|
|
opacity: 0.6
|
|
}
|
|
|
|
DropdownExpandedList {
|
|
Layout.fillWidth: true
|
|
options: root.dropdown ? root.dropdown.options : []
|
|
}
|
|
|
|
FlexRow {
|
|
Layout.fillWidth: true
|
|
spacing: 8
|
|
|
|
CBadge {
|
|
text: root.dropdown
|
|
? root.dropdown.options.length
|
|
+ " options"
|
|
: "0 options"
|
|
}
|
|
CBadge {
|
|
text: root.dropdown
|
|
&& root.dropdown.required
|
|
? "Required" : "Optional"
|
|
accent: root.dropdown
|
|
? root.dropdown.required
|
|
: false
|
|
}
|
|
CBadge {
|
|
text: root.dropdown
|
|
&& root.dropdown.allowCustom
|
|
? "Custom values OK"
|
|
: "Fixed options only"
|
|
}
|
|
}
|
|
}
|
|
}
|