Skip to content

fix(editor): a click while the page scrolls edits the block on desktop - #13635

Merged
tiensonqin merged 1 commit into
logseq:masterfrom
yuxi-liu-wired:fix/click-after-scroll
Oct 7, 2026
Merged

tiensonqin merged 1 commit into
logseq:masterfrom
yuxi-liu-wired:fix/click-after-scroll

Conversation

@yuxi-liu-wired

Copy link
Copy Markdown
Contributor

Problem

On desktop, a click on a block sometimes does not start editing it. Nothing happens; a second click works.

It happens when the click comes within about 250 ms of the page scrolling: for example right after moving a block with Alt+Shift+Up/Down (the moved block is scrolled into view), or right after a wheel scroll. The click lands, but the block's pointerdown handler returns early.

Cause

block-content-on-pointer-down ignores every pointerdown while :ui/scrolling? is true (060a0dd, "fix(mobile): don't switch to editing mode when scrolling"). listen-to-scroll! sets the flag on a scroll event (debounced 100 ms) and clears it 150 ms after the last one. The check exists so that the touch that scrolls a page on mobile is not taken as a tap, but it applies on desktop too, where a pointerdown is always a click.

Fix

The check applies only on mobile (util/mobile?). Desktop clicks during a scroll edit the block as they do at any other time.

Test

frontend.components.block.scroll-click-test calls the real pointerdown handler with a left click:

  • desktop, page scrolling: edits (fails on master)
  • desktop, no scroll: edits
  • mobile, page scrolling: does not edit (the mobile behavior is kept)

## Problem

On desktop, a click on a block sometimes does not start editing it. Nothing happens; a second click works.

It happens when the click comes within about 250 ms of the page scrolling: for example right after moving a block with Alt+Shift+Up/Down (the moved block is scrolled into view), or right after a wheel scroll. The click lands, but the block's pointerdown handler returns early.

## Cause

`block-content-on-pointer-down` ignores every pointerdown while `:ui/scrolling?` is true (060a0dd, "fix(mobile): don't switch to editing mode when scrolling"). `listen-to-scroll!` sets the flag on a scroll event (debounced 100 ms) and clears it 150 ms after the last one. The check exists so that the touch that scrolls a page on mobile is not taken as a tap, but it applies on desktop too, where a pointerdown is always a click.

## Fix

The check applies only on mobile (`util/mobile?`). Desktop clicks during a scroll edit the block as they do at any other time.

## Test

`frontend.components.block.scroll-click-test` calls the real pointerdown handler with a left click:

- desktop, page scrolling: edits (fails on master)
- desktop, no scroll: edits
- mobile, page scrolling: does not edit (the mobile behavior is kept)
@tiensonqin
tiensonqin force-pushed the fix/click-after-scroll branch from bedef4f to 75e4ee9 Compare October 7, 2026 11:34
@tiensonqin
tiensonqin merged commit 64429eb into logseq:master Oct 7, 2026
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 8, 2026
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 8, 2026
#13635)

## Problem

On desktop, a click on a block sometimes does not start editing it. Nothing happens; a second click works.

It happens when the click comes within about 250 ms of the page scrolling: for example right after moving a block with Alt+Shift+Up/Down (the moved block is scrolled into view), or right after a wheel scroll. The click lands, but the block's pointerdown handler returns early.

## Cause

`block-content-on-pointer-down` ignores every pointerdown while `:ui/scrolling?` is true (148a3dc, "fix(mobile): don't switch to editing mode when scrolling"). `listen-to-scroll!` sets the flag on a scroll event (debounced 100 ms) and clears it 150 ms after the last one. The check exists so that the touch that scrolls a page on mobile is not taken as a tap, but it applies on desktop too, where a pointerdown is always a click.

## Fix

The check applies only on mobile (`util/mobile?`). Desktop clicks during a scroll edit the block as they do at any other time.

## Test

`frontend.components.block.scroll-click-test` calls the real pointerdown handler with a left click:

- desktop, page scrolling: edits (fails on master)
- desktop, no scroll: edits
- mobile, page scrolling: does not edit (the mobile behavior is kept)
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 11, 2026
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 11, 2026
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 13, 2026
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 16, 2026
@yuxi-liu-wired
yuxi-liu-wired deleted the fix/click-after-scroll branch October 21, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants