iPhone: one Return makes two line breaks (gap above the new bullet) #225

Closed
opened 2026-10-14 09:24:32 +00:00 by kayg · 2 comments
Owner

kayg on an iPhone (Safari), today's note:

  • Pressing Return once on a list item leaves a big empty gap: the next bullet lands two lines down, or a blank line plus the bullet appears.
  • The caret also jumps to an empty line under the log line.
  • See the screenshots: before Return, after Return and after typing.

Suspects:

  • iOS sends both beforeinput (insertParagraph/insertLineBreak) and a keydown Enter, and both are handled.
  • The list-continuation transform runs twice.
  • Or an empty line is being drawn extra-tall, the same "lines that disappear into the void" seen elsewhere.

Reproduce in WebKit with iOS-style input events (insertParagraph through beforeinput), find the cause, fix it, and add a regression test. Check Return in: a list item, an empty list item (it should end the list), a heading, plain text, and a log line.

kayg on an iPhone (Safari), today's note: - Pressing Return once on a list item leaves a big empty gap: the next bullet lands two lines down, or a blank line plus the bullet appears. - The caret also jumps to an empty line under the log line. - See the screenshots: before Return, after Return and after typing. **Suspects:** - iOS sends both `beforeinput` (insertParagraph/insertLineBreak) and a keydown Enter, and both are handled. - The list-continuation transform runs twice. - Or an empty line is being drawn extra-tall, the same "lines that disappear into the void" seen elsewhere. Reproduce in WebKit with iOS-style input events (`insertParagraph` through `beforeinput`), find the cause, fix it, and add a regression test. Check Return in: a list item, an empty list item (it should end the list), a heading, plain text, and a log line.
Author
Owner

![](https://git.kayg.org/attachments/d5ec74fa-0895-42d3-9e75-a75d523d4a14) ![](https://git.kayg.org/attachments/22719080-ee2e-4c15-aa12-1a9953a274cd) ![](https://git.kayg.org/attachments/ae7082b0-604c-47c8-9a6e-a4225623519c)
Author
Owner

Cause found, fix in #239.

The file on calternal.cloud (Notes/2026-10-14.md, read only) has real blank lines in it, so this is an input bug, not a drawing bug:

- [09:30 - 10:30 Meeting with Gabriel …](<…>)
(4 empty lines)
- raietnarsioten
- raietnarsioten
(empty)
- 
(empty)
  (two spaces)
(empty)
  ---

Once a list has a blank line in it, CodeMirror's markdown Return treats the list as "loose": every Return adds a blank line before the new bullet, and Return on an empty item pushes it down a line instead of ending the list. That explains both the gap and the caret landing on an empty, indented line.

It is not iOS sending Return twice. In WebKit with an iPhone user agent I logged the events: keydown Enter, the browser's own beforeinput insertLineBreak, then CodeMirror's one replayed Return. The command runs once. Empty lines are drawn at the height of a text line (checked in the new e2e test).

The fix: Return in a list never adds a blank line, and an empty item always ends the list (or steps out a level when nested). Return in a log line, a heading and plain text was checked too. The blank lines already in the note stay; only new ones stop.

Tests: packages/editor/test/enter.test.ts (4 of 7 fail without the fix) and apps/web/e2e/enter.spec.ts (Chromium and WebKit with an iPhone user agent, 390 and 1440, all pass; the list and empty-item tests fail without the fix).

Performance: Return now does one extra pass over the few characters CodeMirror inserts. It does no parsing or work that grows with the note, so it adds nothing measurable.

After the fix, kayg's note shape with Return, three, Return: WebKit 390 and 320, Chromium 390 and 320:

after-webkit-390-light.png after-webkit-320-light.png after-chromium-390-light.png after-chromium-320-light.png

**Cause found, fix in #239.** The file on calternal.cloud (`Notes/2026-10-14.md`, read only) has real blank lines in it, so this is an input bug, not a drawing bug: ``` - [09:30 - 10:30 Meeting with Gabriel …](<…>) (4 empty lines) - raietnarsioten - raietnarsioten (empty) - (empty) (two spaces) (empty) --- ``` Once a list has a blank line in it, CodeMirror's markdown Return treats the list as "loose": every Return adds a blank line before the new bullet, and Return on an empty item pushes it down a line instead of ending the list. That explains both the gap and the caret landing on an empty, indented line. It is not iOS sending Return twice. In WebKit with an iPhone user agent I logged the events: `keydown Enter`, the browser's own `beforeinput insertLineBreak`, then CodeMirror's one replayed Return. The command runs once. Empty lines are drawn at the height of a text line (checked in the new e2e test). The fix: Return in a list never adds a blank line, and an empty item always ends the list (or steps out a level when nested). Return in a log line, a heading and plain text was checked too. The blank lines already in the note stay; only new ones stop. Tests: `packages/editor/test/enter.test.ts` (4 of 7 fail without the fix) and `apps/web/e2e/enter.spec.ts` (Chromium and WebKit with an iPhone user agent, 390 and 1440, all pass; the list and empty-item tests fail without the fix). Performance: Return now does one extra pass over the few characters CodeMirror inserts. It does no parsing or work that grows with the note, so it adds nothing measurable. After the fix, kayg's note shape with Return, `three`, Return: WebKit 390 and 320, Chromium 390 and 320: ![after-webkit-390-light.png](https://git.kayg.org/attachments/f8fdacfc-e406-44d5-9f3a-9d8ed6eadef9) ![after-webkit-320-light.png](https://git.kayg.org/attachments/1fc0f547-af87-41ae-a383-8c72a8d3dff6) ![after-chromium-390-light.png](https://git.kayg.org/attachments/a24d079f-cb5e-478e-b404-43b167fe50e8) ![after-chromium-320-light.png](https://git.kayg.org/attachments/b90dee1b-cc3e-42cc-ba10-68bde721ad23)
kayg closed this issue 2026-10-14 11:15:54 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#225
No description provided.