Skip to content

fix(editor): collapse arrow, ordered-list Backspace, date picker Enter and selection bar actions - #13890

Closed
yuxi-liu-wired wants to merge 6 commits into
logseq:masterfrom
yuxi-liu-wired:fix/dbtest-uibatch
Closed

yuxi-liu-wired wants to merge 6 commits into
logseq:masterfrom
yuxi-liu-wired:fix/dbtest-uibatch

Conversation

@yuxi-liu-wired

@yuxi-liu-wired yuxi-liu-wired commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes logseq/db-test#1189, logseq/db-test#1417, logseq/db-test#1041, logseq/db-test#1391, logseq/db-test#1207.

Five editor and selection UI bugs, one commit each, plus a follow-up commit for #1189 (see below). They touch separate code; the only shared file is editor.cljs (two small hunks, one line and one function body), so the changes stay small next to #13782 and #13865.

What the user sees

  • github sync not working as expected #1189: a block whose properties are all hidden (or are empty, hidden class properties) shows the expand/collapse arrow, and expanding it shows nothing.
  • Perf/db serialization #1417: in an ordered list, Backspace at the start of an empty item turns it back into a bullet, but the next Backspace does the same again and the block cannot be deleted until the editor loses focus.
  • Can't display Jan 1st 2021 journal page #1041: in the property date picker (/deadline, /scheduled, date properties), choosing a day with the arrow keys and pressing Enter saves today's date or the old value instead of the chosen day, or sets it and then reverts it.
  • the graph doesn't show on the full page  #1391: with the selection toolbar open, extending the selection with Shift+Down and using Tags tags only the blocks selected when the toolbar appeared. Shrinking the selection tags blocks that are no longer selected.
  • win10桌面版下图谱显示存在问题 #1207: the trash button in the selection toolbar shows the delete confirmation only while the mouse button is held down; releasing the button closes it.

Cause

  • github sync not working as expected #1189: db-collapsable? counted every property key on the block. The properties area renders only the visible rows of the block's display properties, so hidden properties made the block look expandable.
  • Perf/db serialization #1417: delete-block-when-zero-pos! read the list type from state/get-edit-block, which is captured when editing starts and still has :logseq.property/order-list-type after the first Backspace removed it.
  • Can't display Jan 1st 2021 journal page #1041: Enter on a calendar day ran the day's key handler (which selects that day) and then the picker's window keydown handler, which selected initial-day, the day the picker opened on. The later call overwrote the first.
  • the graph doesn't show on the full page  #1391: the toolbar loads the selected blocks once for the ids read at render and stays mounted while the selection changes. Tags, Set property and Unset property passed those blocks to the dialog, which prefers passed blocks over the live selection.
  • win10桌面版下图谱显示存在问题 #1207: the delete ran on :on-pointer-down and opened the confirmation; the pointer-up of the same press counted as an outside click and closed it.

Change

  • github sync not working as expected #1189: when the block has :block.temp/display-properties, db-collapsable? counts only its :full-properties rows. Blocks without it keep the key-based check; query blocks stay collapsable.
  • github sync not working as expected #1189 follow-up: while a block's hidden properties are shown (the per-block toggle in the properties area), db-collapsable? also counts its :hidden-properties rows, so a block that was collapsed with its hidden rows shown still has an arrow to reopen them. A block whose hidden rows are not shown still has no arrow. The per-block set moved from frontend.components.property to frontend.state (*show-hidden-properties-block-ids) so the editor handler can read it; toggle-hidden-properties-visibility!, hidden-properties-visible? and the hook behave as before, and the hook (use-hidden-properties-visible) is now public so block-control can use it to rerender the arrow when the state changes. Not covered: the global "show empty and hidden properties" mode also renders hidden rows; the arrow does not account for it.
  • Perf/db serialization #1417: (own-order-number-list? (latest-renderer-block block)), as save-current-block! already reads the current block.
  • Can't display Jan 1st 2021 journal page #1041: the window handler is extracted as confirm-initial-day-on-enter!. It no longer selects the opening day when Enter comes from a calendar day. It still stops the event, and still confirms the opening day when the focus is elsewhere in the picker. The datetime picker (Deadline, Scheduled) still stays open after a day is chosen so the time can be set; that is unchanged.
  • the graph doesn't show on the full page  #1391: new dialog-selected-blocks. Tags, Set property and Unset property pass blocks only when the caller supplied its own selection (table or query view); for the outliner selection they pass none and the dialog reads the selection when it opens. Copy and Add comment still use the blocks loaded at render (not changed here).
  • win10桌面版下图谱显示存在问题 #1207: new trash-button-handlers. The delete runs on click; the pointer-down is still stopped so the press does not clear the selection.

Tests

  • db-collapsable-ignores-hidden-properties-test (editor_test): hidden-only rows are not collapsable, a visible row is, a query block with no rows is.
  • db-collapsable-ignores-hidden-properties-test also covers the follow-up: with the block's hidden rows shown it is collapsable, another block is not, and it stops being collapsable when the rows are hidden again. Without the follow-up change editor-test has 1 failure (the shown-rows assertion); with it, editor-test and the whole unit suite pass.
  • backspace-in-numbered-block-uses-the-latest-list-type-test (editor_test): the first Backspace removes the list type; the second, when the renderer block has no list type but the edit block still does, deletes the block.
  • enter-on-a-calendar-day-does-not-confirm-the-opening-day-test (value_test): Enter on a calendar day selects nothing, elsewhere in the picker selects the opening day, in a form control selects nothing.
  • dialog-selected-blocks-reads-the-outliner-selection-when-the-dialog-opens-test and trash-button-confirms-on-click-not-pointer-down-test (new selection_test).

Proof: with the three source files reverted, the new tests fail (editor-test: 2 failures; value-test: 3 failures; selection-test: 3 failures and 1 error). With the fixes, editor-test (114 tests), value-test (56) and selection-test (2) pass, and the whole unit suite passes. For #1041, #1391 and #1207 the "without" build used the old logic placed inside the new helper functions, since the tests call those helpers.

Not checked in a running app: #1041, #1391 and #1207 are event-timing bugs and the unit tests cover the decision logic, not the browser sequence. #1189 relies on :block.temp/display-properties being present on the rendered block, which render-data? blocks have.

…l hidden

A block whose only properties were hidden ones, or class properties that are empty and hidden, still showed the expand/collapse arrow. Expanding it revealed nothing.

`db-collapsable?` counted every property key on the block, but the properties area renders only the rows in the block's display properties (`:full-properties`); hidden properties are left out and empty class properties can be hidden too.

When the block carries `:block.temp/display-properties`, `db-collapsable?` now counts only the visible `:full-properties` rows. Blocks without it keep the old key-based check, and query blocks stay collapsable.

The test checks that a block with only hidden rows is not collapsable, that one visible row makes it collapsable, and that a query block with no rows is still collapsable.

Fixes logseq/db-test#1189
In an ordered list, Backspace at the start of an empty block turned the numbered item back into a bullet, but every further Backspace did the same and the block could not be deleted until the editor lost focus.

`delete-block-when-zero-pos!` read the list type from the block returned by `state/get-edit-block`, which is captured when editing starts and still has `:logseq.property/order-list-type` after the first Backspace removed it.

The list type is now read from `latest-renderer-block`, the same way `save-current-block!` reads the current block.

The test runs Backspace on an empty numbered block twice: the first removes the list type, and the second, when the renderer's block no longer has the list type but the edit block still does, deletes the block.

Fixes logseq/db-test#1417
…ning day

In the property date picker (the `/deadline` and `/scheduled` commands and date properties), choosing a day with the arrow keys and pressing Enter saved today's date, or the old value, instead of the chosen day. The date was sometimes set and then reverted.

Enter on a calendar day ran the day's own key handler, which selects that day, and then the picker's window keydown handler, which selected `initial-day`, the day the picker opened on. The later call overwrote the first.

The window handler (now `confirm-initial-day-on-enter!`) no longer selects the opening day when the Enter comes from a calendar day. It still stops the event, and it still confirms the opening day when the focus is elsewhere in the picker.

The test calls the handler with Enter on a calendar day (nothing selected), elsewhere in the picker (opening day selected) and in a form control (nothing selected).

The picker for datetime properties (Deadline, Scheduled) still stays open after a day is chosen, so the time can be set; that is unchanged.

Fixes logseq/db-test#1041
… selection

With the floating selection toolbar open, extending the selection with Shift+Down and then using Tags tagged only the blocks that were selected when the toolbar appeared. Shrinking the selection tagged blocks that were no longer selected.

The toolbar loads the selected blocks once, for the ids read at render, and stays mounted while the selection changes. The Tags, Set property and Unset property buttons passed those blocks to the dialog, and the dialog prefers passed blocks over the live selection.

The three buttons now pass blocks only when the caller supplied its own selection (a table or query view). For the outliner selection they pass none, so the dialog reads the selection when it opens.

The test checks that the outliner selection is left to the dialog and that a caller-supplied selection is passed on.

Fixes logseq/db-test#1391
…utton on click

Clicking the trash button in the selection toolbar (for example on the Pages table) showed the delete confirmation only while the mouse button was held; releasing it closed the dialog, so the selection could not be deleted.

The button ran the delete on `:on-pointer-down`, which opens the confirmation. The pointer-up that ends the same press then counted as an outside click and closed it.

The delete now runs on click. The pointer-down is still stopped, as for the other toolbar buttons, so the press does not clear the selection.

The test checks that the pointer-down alone does not delete or open anything and that the click deletes the selection and hides the action bar.

Fixes logseq/db-test#1207

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

Devin Review

Comment thread src/main/frontend/handler/editor.cljs Outdated
Comment on lines +3727 to +3728
property-keys (if display-properties
(map :property-id (:full-properties display-properties))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Hidden properties lose their expand control

When hidden properties are shown on a block with no visible rows, db-collapsable? removes its expand control. properties-area renders those hidden rows only while expanded, so collapsing hides them without a way to reopen.

Learn more

The block's render snapshot lists normally visible rows in :full-properties and hidden rows in :hidden-properties. properties-area separately tracks whether hidden properties are currently shown and renders their rows when enabled; block-content mounts that area only when the block is expanded. The new collapsibility check does not account for that visibility state, so it removes the arrow even when expansion reveals hidden rows.

Example: Give a block one property marked hidden, turn on its hidden-property display, then collapse the block. Its hidden row disappears and the expand arrow is absent, although expanding must reveal the row.

Recommended fix: Make the collapsibility calculation include currently displayed hidden rows, using the same per-block visibility state as properties-area, and ensure the control rerenders when that state changes. Preserve the no-arrow behavior when hidden rows are not shown.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

…s are shown

After 734b27a a block with no visible property rows has no collapse arrow. If its hidden properties were shown (the "show hidden properties" toggle) and the block was then collapsed, there was no arrow to open it again, so the hidden rows could not be reached.

`db-collapsable?` now also counts the block's hidden rows while the block is in the per-block set the properties area uses to show them. That set moves from `frontend.components.property` to `frontend.state` (`*show-hidden-properties-block-ids`) so the editor handler can read it; the toggle and its hook keep their behaviour. `block-control` uses the hook so the arrow rerenders when the block's hidden rows are shown or hidden. A block whose hidden rows are not shown still has no arrow.

The test shows the hidden rows of a block and checks that it is collapsable, that another block with the same kind of rows is not, and that it stops being collapsable once the rows are hidden again.

Refs logseq/db-test#1189
@yuxi-liu-wired

Copy link
Copy Markdown
Contributor Author

Thanks, that was a real gap. Fixed in 11e6706.

Change

  • db-collapsable? now also counts the block's :hidden-properties rows while that block is in the per-block "hidden properties shown" set that the properties area uses. A block with no visible rows whose hidden rows are shown keeps its arrow, so after collapsing it the hidden rows can be reopened. When the hidden rows are not shown there is still no arrow.
  • The set (*show-hidden-properties-block-ids) moved from frontend.components.property to frontend.state, because the editor handler cannot require the component namespace. toggle-hidden-properties-visibility!, hidden-properties-visible? and the hook behave as before.
  • use-hidden-properties-visible is now public, and block-control calls it, so the arrow rerenders when the block's hidden rows are shown or hidden (the arrow depends on collapsable?, which now reads that state).

Test

  • db-collapsable-ignores-hidden-properties-test has a new case: with the block's hidden rows shown the block is collapsable; another block with the same kind of rows is not; after the rows are hidden again it is not. Without the change editor-test fails on the first assertion of that case (1 failure); with it editor-test passes and so does the whole unit suite.
  • The rerender (hook in block-control) is not covered by a test; only the db-collapsable? decision is.

Not covered: the global "show empty and hidden properties" mode (:ui/show-empty-and-hidden-properties?) also renders hidden rows, and the arrow does not account for it. It uses different state and I kept to the per-block toggle.

@yuxi-liu-wired

Copy link
Copy Markdown
Contributor Author

Combined into #13870 with the other PRs of this theme, to keep the number of open PRs down; the commits are unchanged there.

@yuxi-liu-wired
yuxi-liu-wired deleted the fix/dbtest-uibatch branch November 17, 2026 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect child block UI when a hidden property has an empty value

1 participant