W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2011

[Bug 13831] New: Deleting a block should leave style tags nested inside

From: <bugzilla@jessica.w3.org>
Date: Thu, 18 Aug 2011 21:25:16 +0000
To: public-webapps@w3.org
Message-ID: <bug-13831-2927@http.www.w3.org/Bugs/Public/>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=13831

           Summary: Deleting a block should leave style tags nested inside
           Product: WebAppsWG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HTML Editing APIs
        AssignedTo: ayg@aryeh.name
        ReportedBy: ayg@aryeh.name
         QAContact: sideshowbarker+html-editing-api@gmail.com
                CC: mike@w3.org, public-webapps@w3.org


Based on WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=7360

Normally if we delete the full contents of a formatting tag like <b>, we delete
the tag itself for tidiness, since there's no way to focus the tag anyway. 
E.g., if you delete foo<b>[bar]</b>baz, it becomes foo[]baz, not
foo<b></b>[]baz or anything.  State/value overrides (typing style in WebKit
terms) ensure that if the user types again before moving the cursor, the text
has the right style.

However, this is bad when the tag is the only thing in a block.  Consider

  <p>foo</p>
  <p>bar</p>
  <p>baz</p>

The user selects all the text and bolds it:

  <p><b>foo</b></p>
  <p><b>bar</b></p>
  <p><b>baz</b></p>

Then deletes "bar".  Currently it becomes

  <p><b>foo</b></p>
  <p><br></p>
  <p><b>baz</b></p>

so if the user moves away and back and types, the text in the middle is no
longer bold.  This isn't what the user wants: they made all three paragraphs
bold and want them to stay bold.

The solution is to insert a <br> if necessary *before* we strip wrappers.  Then
when we get to stripping wrappers, there will be a child, so we won't.  This
will produce

  <p><b>foo</b></p>
  <p><b><br></b></p>
  <p><b>baz</b></p>

which should have the desired effect.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Thursday, 18 August 2011 21:25:17 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:47 GMT