Skip to content

fix: keep heading fold arrows on the right - #13939

Merged
tiensonqin merged 2 commits into
masterfrom
logseq/fix-heading-fold-button-right-b3d2
Nov 9, 2026
Merged

tiensonqin merged 2 commits into
masterfrom
logseq/fix-heading-fold-button-right-b3d2

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes logseq/db-test#1509

Cause

On the web build, state/enable-fold-button-right? adds main.ls-fold-button-on-right below the sm breakpoint on a phone. That stylesheet sets .block-control-wrap to position: static and .ls-block .block-control to position: absolute; right: -4px, so the fold arrow is placed against the block row.

block.css is more specific for h1/h2:

.block-main-container[data-has-heading="1"] > .block-control-wrap { position: relative; top: 1rem; }
.block-main-container[data-has-heading="2"] > .block-control-wrap { position: relative; top: 0.625rem; }

Specificity (0, 3, 0) beats main.ls-fold-button-on-right .block-control-wrap at (0, 2, 1). The relative wrapper becomes the arrow's containing block, so the arrow lands on the bullet and the bullet tap folds instead of zooming.

The native app already avoids this in src/main/mobile/components/app.css by keeping heading wrappers static and offsetting them with margin. That file is mobile-app only. Journal blocks are also outside .blocks-container, so copying the mobile selector unchanged would miss the web home page.

Fix

The same static wrapper and mobile margins (mt-[18px] / mt-3, including > .block-control) now live under main.ls-fold-button-on-right .block-main-container. Those selectors are (0, 4, 1) and (0, 5, 1), so they win over the heading top rules and over the fold rule's margin-top: 0. Left-fold desktop never gets the class. On the native app the shared values match app.css, so blocks already covered there keep the same offsets.

Screenshots

Phone viewport, fold arrows on the right, before:

Before: h2 fold arrow sits on the bullet while a normal block

After, h1 and a normal block:

After: h1 fold arrow is on the right of the heading

After, h2:

After: h2 fold arrow is on the right of the heading

Tapping the h1 bullet zooms into the block:

After: tapping the h1 bullet zooms into the block

Tests

No new unit test. This is computed layout. Checked in the web build at localhost:3001:

  • iPhone viewport (390px, mobile user agent): main has ls-fold-button-on-right. Before the change, h1/h2 wrappers were position: relative and elementFromPoint on the bullet hit .block-control. After, h1 uses margin-top: 18px, h2 uses 12px, the arrow sits at the right edge, the bullet is the hit target, and tapping it zooms.
  • Desktop 1280px with a desktop user agent: the fold-on-right class is absent, and the h1 wrapper stays position: relative with top: 16px.

stylelint on theme.css still reports existing issues in that file. This change does not add a duplicate selector or a new comma-newline warning. Icon headings use the same margin calc as the mobile app and were not clicked through in the browser.

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Devin Review

@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/components/theme.css Resolved
cursoragent and others added 2 commits November 9, 2026 13:48
Heading wrappers in block.css are position:relative, which beats the
fold-on-right static wrapper and places the absolute arrow on the bullet.
Use the mobile app's static wrapper and margin offsets under
main.ls-fold-button-on-right.

Co-authored-by: Tienson Qin <[email protected]>
@megayu
megayu force-pushed the logseq/fix-heading-fold-button-right-b3d2 branch from 37fe8aa to 51d46a3 Compare November 9, 2026 06:02
@tiensonqin
tiensonqin merged commit 274950e into master Nov 9, 2026
@tiensonqin
tiensonqin deleted the logseq/fix-heading-fold-button-right-b3d2 branch November 9, 2026 13:26
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.

Web build on a phone: the fold arrow of an h1/h2 block lies on its bullet, so tapping the bullet folds instead of zooming in

3 participants