Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Safari] Double-clicking around widgets with nested editable breaks selection #4601

Closed
oleq opened this issue Mar 28, 2019 · 2 comments
Closed
Labels
package:widget resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior). type:bug This issue reports a buggy (incorrect) behavior.

Comments

@oleq
Copy link
Member

oleq commented Mar 28, 2019

Is this a bug report or feature request? (choose one)

🐞 Bug report

💻 Version of CKEditor

master

📋 Steps to reproduce

Use the nested editable manual test from ckeditor5-widget.

Double click at the end of the nested editable
Kapture 2019-03-28 at 12 05 59

Alternatively double click before a widget with a NE.

✅ Expected result

The selection should not cross the boundary of the widget.

❎ Actual result

The selection crosses the boundary of the widget.

📃 Other details that might be useful

A follow-up of #1463.

@pomek
Copy link
Member

pomek commented Mar 28, 2019

function shouldFixSelection( domEventData, view ) {
    if ( !env.isSafari ) {
        return false;
    }

    if ( domEventData.domEvent.detail == 2 && view.document.selection.getLastPosition().isAtEnd ) {
        return true;
    }

    if ( domEventData.domEvent.detail >= 3 ) {
        return true;
    }

    return false;
}

Use the function in order to check whether the selection should be updated in widget mousedown event handler. The code above fixes case inside the NE. Still need to figure out how to fix TC when you click before NE.

@Reinmar
Copy link
Member

Reinmar commented Apr 8, 2019

The selection is correctly set in the model and correctly rendered (in terms of its logical position in the DOM):

image

The only problem here is that it's not entirely correct visually, but that's an upstream issue.

@Reinmar Reinmar closed this as completed Apr 8, 2019
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-widget Oct 9, 2019
@mlewand mlewand added resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior). status:confirmed type:bug This issue reports a buggy (incorrect) behavior. package:widget labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:widget resolution:invalid This issue is invalid (e.g. reports a non-existent bug or a by-design behavior). type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

No branches or pull requests

4 participants