Skip to content

Export dialog: checkboxes cannot be reliably unchecked (depends on where inside the box you click) #1418

Closed
logseq/logseq
#13659

Description

@white66-7

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

  1. Open any page with at least one block of content.
  2. Right-click a block → "Export" (or use the page menu → "Export page…"). The "Export blocks" dialog opens.
  3. In the dialog, enable an option, e.g. tick "[[Text]] -> Text".
  4. 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.
  5. 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:

  1. frontend/ui.cljs lines 333-350 — checkbox wrapper

    (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 .checked onto e.target.

  2. logseq/shui/components.cljs lines 609-634 — the Checkbox component

    It has two branches:

    • data-inputless (lines 616-627): renders a plain <span role="checkbox">
      and sets aria-checked, data-state, data-checked from the checked prop.
    • default (lines 628-634): renders Base UI Checkbox.Root with
      render: <button>, nativeButton: true, and an inner
      Checkbox.Indicator (<span>) containing IconCheck (<svg>).

    Because the export dialog passes :on-change (not :on-click), the
    data-inputless branch 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.

  3. frontend/state.cljs lines 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.cljc lines 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 from event.target.dataset.state.

  4. frontend/components/export.cljs lines 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

  1. transferred this issue fromlogseq/logseqon Oct 9, 2026
  2. added 3 commits that reference this issue on Nov 18, 2026
    0407d06
    13c595c
    7b393bf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions