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

Ctrl + backspace doesn't delete a whole word #414

Closed
ssougnez opened this issue Mar 15, 2017 · 2 comments
Closed

Ctrl + backspace doesn't delete a whole word #414

ssougnez opened this issue Mar 15, 2017 · 2 comments
Labels
resolution:duplicate This issue is a duplicate of another issue and was merged into it. type:feature This issue reports a feature request (an idea for a new functionality or a missing option).

Comments

@ssougnez
Copy link

When hitting "ctrl + backspace", only one character is deleted while it should be the entire word.

@Reinmar Reinmar added status:confirmed type:feature This issue reports a feature request (an idea for a new functionality or a missing option). labels Mar 16, 2017
@Reinmar
Copy link
Member

Reinmar commented Mar 16, 2017

Yep, we skipped that for a moment since it's not trivial to implement it considering all languages.

We have two options.

  1. We can either try implementing it in JS and improve the implementation for less popular languages with time, based on bug reports.
  2. Or we can try an approach where we don't use preventDefault() when discovering Ctrl + Backspace and let the browser delete a proper fragment of the text and try to work with mutations.

Actually, there's also a 3rd option – wait for the beforeinput event (or pick one of the above but use the event if it's present). beforeinput is a new event proposed by the Editing TF (W3C) and I've already did some checks for W3C how it works us. Back then, it allowed us to check which part of the text the browser would delete (so discovering words boundaries in the text would be done by the browser) but we were able to handle the deletion by ourselves (we were able to call preventDefault()). Blink and Webkit already have parts of this event working. Unfortunately, recently, Google changed their mind and it seems that we'll lose the ability to prevent the default action of the event, which means that we'll have to let the browser change the DOM and then we'll need to re-render the DOM as we see it, which may lead to some problems (mostly – with composition). Still, since we're able to quite reliably handle most of the input right now (using mutations and listening on backspace/delete keys), it may come with help to handle the other cases (deleting words, lines, etc).

PS. We'll also need to use some hybrid solution to handle backspacing on devices which don't provide key codes in keydown events – e.g. Chrome@Android. AFAIK (but I'd need to check again) there was no way to check which key was pressed, so we need other ways to figure this out.

@Reinmar Reinmar changed the title ctrl + backspace not handled correctly Ctrl + backspace doesn't delete a whole word Mar 16, 2017
@Reinmar
Copy link
Member

Reinmar commented Mar 16, 2017

Let's move the ticket to ckeditor5-typing: https://github.com/ckeditor/ckeditor5-typing/issues/92.

@Reinmar Reinmar closed this as completed Mar 16, 2017
@Reinmar Reinmar added the resolution:duplicate This issue is a duplicate of another issue and was merged into it. label Mar 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution:duplicate This issue is a duplicate of another issue and was merged into it. type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

No branches or pull requests

2 participants