Skip to content

Incorrect selection behavior when inserting SVGs inside of an inline widget #14388

Open
@mabryl

Description

📝 Provide detailed reproduction steps (if any)

  1. Create an inline widget plugin based on the Implementing an inline widget guide
  2. Make the widget insert an SVG, for example, by using this code snippet:
const innerText = viewWriter.createRawElement( 'i', { id: 'foo-1234' }, function( domElement ) {
  domElement.innerHTML = `
    <svg fill="#000000" width="50px" height="50px" viewBox="-6.5 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg">
      <path d="M9.281 9.688h2.406v2.406h-2.406v-2.406zM9.813 21.969l2.188 1.031-2.906 6.125-1.906-0.906z"></path>
    </svg>
  `;
} );
  1. Build the editor with the plugin included
  2. Try placing the selection after the inserted SVG

✔️ Expected result

The caret should appear to the right of the SVG, as is the case when inserting text via this method:

text.mov

❌ Actual result

You can't place the caret after the SVG. This example is from Google Chrome:

svg_chrome.mov

📃 Other details

  • Browser: different browsers act differently in this case, see comment below for details
  • OS: cross-OS
  • First affected CKEditor version: N/A
  • Installed CKEditor plugins: N/A

If you'd like to see this fixed sooner, add a 👍 reaction to this post.

Metadata

Assignees

No one assigned

    Labels

    squad:coreIssue to be handled by the Core team.support:2An issue reported by a commercially licensed client.type:bugThis issue reports a buggy (incorrect) behavior.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions