Skip to content

Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.

Merge main into refactor/escape-layers

Guido Boyke2d60c7acc580
diff --cc app/javascript/controllers/layout_toggle_controller.js
index 8732a78,f3c0090..005fb72
--- a/app/javascript/controllers/layout_toggle_controller.js
+++ b/app/javascript/controllers/layout_toggle_controller.js
@@@ -1,6 -1,6 +1,7 @@@
import { Controller } from "@hotwired/stimulus"
import { readLaneParams, laneParamNames } from "lane/params"
+ import { controlIndexPath, indexPaths } from "lane/filter_context"
+import { escapeOwned } from "escape_owner"
// The fixed-height list/detail grids (Tickets table, Knowledge, Meetings) fill the
// viewport instead of carrying a hardcoded `calc(100vh - <magic>)` height. The bottom
@@@ -118,11 -130,12 +131,16 @@@ export default class extends Controlle
this.element.addEventListener('click', this.boundSyncFilterContext, true)
this.element.addEventListener('submit', this.boundSyncFilterContext, true)
+ // A write that ends the lane's object (a deleted meeting) closes the lane
+ // through the closeLane stream action (application.js).
+ this.boundCloseLane = this.closeLane.bind(this)
+ document.addEventListener('lane:close', this.boundCloseLane)
+
- // ESC key closes content panel
+ // ESC key closes content panel, unless something on top owns it. Who owns
+ // it is asked in the capture phase on window, before any listener has run:
+ // an owner that closes itself on its own element looks closed afterwards.
+ this.boundNoteEscapeOwner = this.noteEscapeOwner.bind(this)
+ window.addEventListener('keydown', this.boundNoteEscapeOwner, true)
this.boundCloseOnEscape = this.closeOnEscape.bind(this)
document.addEventListener('keydown', this.boundCloseOnEscape)
@@@ -137,7 -150,7 +155,8 @@@
document.removeEventListener('turbo:before-stream-render', this.boundHandleListStream)
this.element.removeEventListener('click', this.boundSyncFilterContext, true)
this.element.removeEventListener('submit', this.boundSyncFilterContext, true)
+ document.removeEventListener('lane:close', this.boundCloseLane)
+ window.removeEventListener('keydown', this.boundNoteEscapeOwner, true)
document.removeEventListener('keydown', this.boundCloseOnEscape)
window.removeEventListener('resize', this.boundScheduleGridHeight)
if (this._gridHeightRaf) cancelAnimationFrame(this._gridHeightRaf)
diff --cc config/importmap.rb
index 9958723,c9b2581..3cf1e4f
--- a/config/importmap.rb
+++ b/config/importmap.rb
@@@ -43,11 -41,11 +41,13 @@@ pin 'column_picker/order', to: 'lib/col
pin 'assignee_menu/diff', to: 'lib/assignee_menu/diff.js'
pin 'kanban/keyboard', to: 'lib/kanban/keyboard.js'
pin 'list_row/address', to: 'lib/list_row/address.js'
- # The lane's parameter groups and what Back restores (doc/dateivorschau_plan.md, D9 and D2).
+ # The lane's parameter groups and what Back restores (doc/dateivorschau_plan.md, D9 and D2),
+ # and which controls take the list state beside an open lane (filter_context).
pin 'lane/params', to: 'lib/lane/params.js'
pin 'lane/history', to: 'lib/lane/history.js'
+ pin 'lane/filter_context', to: 'lib/lane/filter_context.js'
+# Who takes an Escape: the topmost menu, modal or drawer, before the lane.
+pin 'escape_owner', to: 'lib/escape_owner.js'
# The document forms' drop zone: the title a file suggests (S4 of doc/dokumentansicht_plan.md).
pin 'upload_zone/title', to: 'lib/upload_zone/title.js'
# The folder target a type condition becomes (pure, node:test).
diff --cc spec/javascript/controllers/layout_toggle_controller.test.js
index adee341,9d5b58b..1ec210e
--- a/spec/javascript/controllers/layout_toggle_controller.test.js
+++ b/spec/javascript/controllers/layout_toggle_controller.test.js
@@@ -3,7 -3,7 +3,8 @@@ import assert from 'node:assert/strict
import { readFileSync } from 'node:fs'
import { runInNewContext } from 'node:vm'
import { laneParamNames } from '../../../app/javascript/lib/lane/params.js'
+ import { controlIndexPath, indexPaths } from '../../../app/javascript/lib/lane/filter_context.js'
+import { escapeOwned } from '../../../app/javascript/lib/escape_owner.js'
const source = readFileSync(new URL('../../../app/javascript/controllers/layout_toggle_controller.js', import.meta.url), 'utf8')
.replace(/^import .*\n/gm, '')
@@@ -16,7 -16,7 +17,7 @@@ function controllerWith(document, { win
CustomEvent: class {
constructor(type, options) { this.type = type; Object.assign(this, options) }
},
- readLaneParams: () => groups, laneParamNames, escapeOwned
- readLaneParams: () => groups, laneParamNames, controlIndexPath, indexPaths
++ readLaneParams: () => groups, laneParamNames, controlIndexPath, indexPaths, escapeOwned
})
const controller = new Controller()
controller.listFilterParamsValue = []