Repository navigation
Description
Search first
- I searched and no similar issues were found
What Happened?
In the "Export blocks" dialog (right-click a block → Export, or the page menu → Export page), the option checkboxes only uncheck sometimes. Whether a click actually toggles the option depends on where inside the checkbox square you click.
The affected checkboxes are the ones rendered from text-remove-options / text-other-options in the export dialog:
- [[Text]] -> Text (page-ref)
- Remove emphasis (emphasis)
- Remove #tags (tag)
- Newline after block (newline-after-block)
- Remove properties (property)
- Export only opened blocks (open-blocks-only)
- Transparent background (PNG mode)
Observed behaviour:
- Clicking the middle of the box (on the checkmark glyph) often does NOT uncheck it.
- Clicking the edge/outline of the box sometimes DOES uncheck it.
- The result is non-deterministic from the user's point of view: the same click gesture produces different results.
Expected: a single click anywhere on the checkbox toggles it, every time.
I have confirmed the exported output itself respects whatever the state ends up being, so this is purely a UI/event-handling bug — no data loss. It is still very confusing because the user cannot reliably control what gets exported.
Reproduce the Bug
- Open any page with at least one block of content.
- Right-click a block → "Export" (or use the page menu → "Export page…"). The "Export blocks" dialog opens.
- In the dialog, enable an option, e.g. tick "[[Text]] -> Text".
- Now try to UNTICK it by clicking precisely in the CENTRE of the checkbox, directly on the white checkmark glyph.
→ The option frequently stays ticked. Repeat the click; it may work on some attempts and not others. - Now try UNTICKING a ticked option by clicking on the BORDER/edge of the same checkbox square.
→ This more often succeeds.
Suggested deterministic probe (what I used): click repeatedly on the checkmark icon itself versus the 1px border of the box, on the same checkbox, and compare the success rate. The centre/icon clicks fail far more often.
Note: the checkboxes are also re-rendered whenever the export content is regenerated, so the failure is easiest to observe on a page with enough blocks that regeneration takes a moment.
Expected Behavior
A single left-click anywhere within the checkbox (the box, its border, its padding, or the checkmark icon) should toggle the option exactly once, deterministically, every time — regardless of which pixel inside the checkbox the pointer happens to hit.
Toggling an option should also recompute the export preview consistently.
Screenshots
No response
Desktop or Mobile Platform Information
Windows 10 Home China (Build 26300.9457), x64 (AMD64)
Logseq Desktop App v2.0.2 (installed, Electron build; app.asar reports version 2.0.2)
Reproduced with the bundled Chromium/Electron engine, no browser involved.
Additional Context
I believe I have located the root cause. Line numbers are from the 2.0.2 sources:
-
frontend/ui.cljslines 333-350 —checkboxwrapper(defn checkbox
[option]
(let [on-change' (:on-change option)
on-click' (:on-click option)
option (cond-> (dissoc option :on-change :on-click)
(and on-click' (nil? on-change'))
(assoc :data-inputless true)(or on-change' on-click') (assoc :on-click (fn [^js e] (some-> on-click' (apply [e])) (let [checked? (= (.-state (.-dataset (.-target e))) "checked")] (set! (. (.-target e) -checked) (not checked?)) (some-> on-change' (apply [e]))))))] (shui/checkbox (merge option {:disabled (or (:disabled option) config/publishing?)}))))The critical lines are 345-346: the wrapper derives the next value from
e.target.dataset.state, then writes.checkedontoe.target. -
logseq/shui/components.cljslines 609-634 — theCheckboxcomponentIt has two branches:
data-inputless(lines 616-627): renders a plain<span role="checkbox">
and setsaria-checked,data-state,data-checkedfrom thecheckedprop.- default (lines 628-634): renders Base UI
Checkbox.Rootwith
render: <button>,nativeButton: true, and an inner
Checkbox.Indicator(<span>) containingIconCheck(<svg>).
Because the export dialog passes
:on-change(not:on-click), the
data-inputlessbranch is NOT taken — it takes the default branch, so the
rendered DOM is a Base UI<button>with a<span>indicator and<svg>icon inside. -
frontend/state.cljslines 1775-1781 — the state handler(defn update-export-block-text-remove-options!
[e k]
(let [f (if (util/echecked? e) conj disj)]
(update-state! :copy/export-block-text-remove-options #(f % k))
...))and
frontend/util.cljclines 150-152:(defn echecked? [event]
(gobj/getValueByKeys event "target" "checked"))So the added/removed decision ultimately depends on
event.target.checked,
which the wrapper at (1) just set fromevent.target.dataset.state. -
frontend/components/export.cljslines 381-387 — a call site(ui/checkbox {:class "mr-2"
:checked (contains? text-remove-options :page-ref)
:on-change (fn [e]
(state/update-export-block-text-remove-options! e :page-ref)
...)})
Are you willing to submit a PR? If you know how to fix the bug.
- I'm willing to submit a PR (Thank you!)
Activity
fix: toggle export option checkboxes on inner clicks
fix: toggle export option checkboxes on inner clicks (#13659)
fix(ui): align LUI desktop web UX with master (#14071)