feat(qt): hotkeys dispatcher, focus lifecycle, multi-select seam (B2)

km
This commit is contained in:
vicrodh committed 2026-08-03 13:32:35 -06:00
1 parent 0cca9abc58
commit 5130e872e7
22 files changed
+475 -79

No files matched your search

@@ -78,6 +78,21 @@ Item {
visible: root.createOpen || root.editOpen
enabled: root.visible
// §1.4.3 (2026-08-03 hotkeys-port contract): both FocusScopes grab focus
// on open and Qt strands it on the now-invisible scope at close, which
// kills the AppShell key dispatcher until the next click. Restore the
// shell root — the dispatcher's fallback focus item — on the close edge.
function _restoreShellFocus() {
var p = root
while (p.parent) {
if (p.parent.isQbzShellRoot === true) {
p.parent.forceActiveFocus()
return
}
p = p.parent
}
}
// ==================================================================
// PANEL 1 — Create folder (CreateFolderModal.slint)
// ==================================================================
@@ -90,6 +105,8 @@ Item {
root.draftCreateName = ""
createScope.forceActiveFocus()
createField.focusField()
} else {
root._restoreShellFocus()
}
}
@@ -237,6 +254,8 @@ Item {
// A sub-modal must never outlive its host panel.
if (!root.editOpen)
deleteConfirm.close()
if (!root.editOpen)
root._restoreShellFocus()
}
FocusScope {
@@ -120,6 +120,23 @@ Item {
}
}
// §1.4.3 (2026-08-03 hotkeys-port contract): the FocusScope grabs focus
// on open and Qt strands it on the now-invisible scope at close, which
// kills the AppShell key dispatcher until the next click. Restore the
// shell root — the dispatcher's fallback focus item — on the close edge.
onEditOpenChanged: if (!root.editOpen) root._restoreShellFocus()
function _restoreShellFocus() {
var p = root
while (p.parent) {
if (p.parent.isQbzShellRoot === true) {
p.parent.forceActiveFocus()
return
}
p = p.parent
}
}
function submit() {
if (root.canSave)
QbzPlaylistEdit.save(root.draftName, root.draftDescription,
@@ -74,6 +74,23 @@ Item {
}
function close() {
root._open = false
root._restoreShellFocus()
}
// §1.4.3 (2026-08-03 hotkeys-port contract): keyScope GRABS focus on open
// and Qt strands activeFocus on the now-invisible item at close, which
// kills the AppShell key dispatcher until the next click. Restore the
// shell root — the dispatcher's fallback focus item — on every close
// path. Duck-walk, because this modal mounts under several parents (the
// Blacklist manager, FolderModals, MyQBZ delete).
function _restoreShellFocus() {
var p = root
while (p.parent) {
if (p.parent.isQbzShellRoot === true) {
p.parent.forceActiveFocus()
return
}
p = p.parent
}
}
function _cancel() {
root.close()
+6 -4
View File
@@ -97,10 +97,12 @@ Rectangle {
}
// Immersive-port contract D16 (2026-08-02, additive one-liner): the ONE
// read-only seam into the inner TextInput's focus. The immersive header
// gates Shift+I and the seek arrows on this ("inert while any text input
// has focus", §5.4) — the input itself stays deliberately unexposed
// (:186). No behavior change for existing consumers.
// read-only seam into the inner TextInput's focus. The immersive root
// reads it as `textInputActive` (ImmersiveView.qml); the Shift+I /
// seek-arrow gates it used to feed are GONE, replaced by the hotkeys
// dispatcher's central text-input gate (2026-08-03 hotkeys-port §1.4.4)
// — the input itself stays deliberately unexposed (:186). No behavior
// change for existing consumers.
readonly property bool fieldActive: input.activeFocus
/// Focus the field from OUTSIDE the control — what a modal needs on open.