Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ff5472ad4fd43e4db15fcd014e675020d381ac78
      
https://github.com/WebKit/WebKit/commit/ff5472ad4fd43e4db15fcd014e675020d381ac78
  Author: Jessica Cheung <[email protected]>
  Date:   2026-07-02 (Thu, 02 Jul 2026)

  Changed paths:
    A 
LayoutTests/editing/smart-lists/smart-list-trigger-requires-marker-only-line-expected.txt
    A 
LayoutTests/editing/smart-lists/smart-list-trigger-requires-marker-only-line.html
    M Source/WebCore/editing/InsertTextCommand.cpp

  Log Message:
  -----------
  [Smart Lists] Typing space attempts to convert my line to a bullet but erases 
the line in the process
https://bugs.webkit.org/show_bug.cgi?id=318273
rdar://177363383

Reviewed by Richard Robinson.

Currently, if the user does any of these three cases, smart lists will trigger:
Case 1: "1. apple<br>2. cherrybanana" --> "1. apple<br>2. cherryban ana" 
(mid-space)
    * Note that case 1 will yield "1.apple<br>2. ana"
Case 2: "1. apple<br>2. cherrybanana" --> "1. apple<br>2. cherrybanana " 
(trailing-space)
Case 3: "1. apple<br>2. cherrybanana" --> "1. apple<br>2.  cherrybanana" 
(leading-space)

This causes a jarring effect when a user has pasted plain text that looks like 
a "list",
but is actually a combination of <div>, <p>, or <span> and there is no <ol> or 
<ul> present.
The effect is typing a space in anywhere in a "list" item that is after the 
first item,
triggers smart list formatting. Then, the entire line of text leading up to the 
cursor is deleted,
and the list marker is added. This produces the "erases the line in the 
process" effect.

To fix this issue, tighten the criteria to `applySmartListsIfNeeded` so it has 
to be the second list item,
have the list marker only and nothing past the marker.

* 
LayoutTests/editing/smart-lists/smart-list-trigger-requires-marker-only-line-expected.txt:
 Added.
* 
LayoutTests/editing/smart-lists/smart-list-trigger-requires-marker-only-line.html:
 Added.
* Source/WebCore/editing/InsertTextCommand.cpp:
(WebCore::InsertTextCommand::applySmartListsIfNeeded):

Canonical link: https://commits.webkit.org/316412@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to