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

IText/Textbox - The first character is ignored when you type after selecting all text #2451

Closed
jafferhaider opened this issue Aug 28, 2015 · 26 comments · Fixed by #2502 or #3137
Closed
Assignees
Milestone

Comments

@jafferhaider
Copy link
Contributor

Steps for recreating:

  1. Type some text into IText or Textbox
  2. Use keyboard shortcut to select all (Cmd+A)
  3. Type some more text. The first character that you type will not appear in the text. Text will start updating when the 2nd character is entered.

This is a recent issue, haven't come across it in the older builds. Any ideas @asturur?

@kangax
Copy link
Member

kangax commented Aug 28, 2015

We need to start adding functional tests where characters are being typed, removed, selected, etc.

Sent from my iPhone

On 28 Aug 2015, at 02:32, Jaffer Haider [email protected] wrote:

Steps for recreating:

  1. Type some text into IText or Textbox
  2. Use keyboard shortcut to select all (Cmd+A)
  3. Type some more text. The first character that you type will not appear in the text. Text will start updating when the 2nd character is entered.

This is a recent issue, haven't come across it in the older builds. Any ideas @asturur?


Reply to this email directly or view it on GitHub.

@marcovdijk
Copy link

Couldn't this be related to #2448?

@kangax kangax added the bug label Aug 31, 2015
@asturur asturur added the text label Sep 17, 2015
@FabianLauer
Copy link

I can confirm this:

capture17092015114005

@asturur asturur self-assigned this Sep 24, 2015
@FabianLauer
Copy link

I don't have the time to write tests at the moment (thus no pull request), but I did find a few minutes to try something out. I think that replacing the onInput method in src/mixins/itext_key_behavior.mixin.js with this might solve the problem:

onInput: function(e) {
if (!this.isEditing || this._cancelOnInput) {
    this._cancelOnInput = false;
    return;
}
var offset = this.selectionStart || 0,
    textLength = this.text.length,
    newTextLength = this.hiddenTextarea.value.length,
    diff = newTextLength - textLength,
    charsToInsert;

if (this.selectionEnd !== 0 && this.selectionEnd !== this.selectionStart && this.selectionEnd === this.text.length) {
    charsToInsert = this.hiddenTextarea.value;
    this._removeCharsFromTo(this.selectionStart, this.selectionEnd);
} else {
    charsToInsert = this.hiddenTextarea.value.slice(offset, offset + diff);
}

this.insertChars(charsToInsert);
e.stopPropagation();
 }

Hope this is at least somewhat helpful.

@asturur
Copy link
Member

asturur commented Sep 27, 2015

found the error and solved. PR is coming.
It was a general error on deciding wich was the new text to add.

@FabianLauer
Copy link

Great news, just made my monday morning. Thanks 😄

@ykka
Copy link

ykka commented Apr 2, 2016

This I think still happens on 1.6.0, or it has been fixed already?
thanks!

@asturur
Copy link
Member

asturur commented Apr 2, 2016

It has been fixed. There are some little problems with internet explorer 11 or edge.

@deepdoon
Copy link

It is still not working for IE 11. Any solution that can do the fix?
Thanks

@deepdoon
Copy link

deepdoon commented May 30, 2016

@kangax @jafferhaider @asturur any update?? please

@schacki
Copy link

schacki commented Jun 1, 2016

This is still not working with 1.6 and Chrome. Any update?

@asturur
Copy link
Member

asturur commented Jun 1, 2016

can you replicate the problem in a fiddle? to me it works.
Please tell us also operating system and keyboard type (latin, american, italian...)

@deepdoon
Copy link

deepdoon commented Jun 3, 2016

@asturur It is not working in IE 11. I checked the same fiddle http://jsfiddle.net/kg9weds5/8/ . Double click to edit. Select all text type something you will see the bug.

@asturur
Copy link
Member

asturur commented Jun 3, 2016

i try today and investigate.

@asturur asturur reopened this Jun 3, 2016
@deepdoon
Copy link

deepdoon commented Jun 3, 2016

Thanks.

@schacki
Copy link

schacki commented Jun 6, 2016

I was working with a RC version. After upgrading to 1.6.2 this has been fixed on Chrome

@deepdoon
Copy link

deepdoon commented Jun 6, 2016

yea but problem still persists in IE.

@asturur asturur added this to the 1.6.3 milestone Jun 6, 2016
@asturur
Copy link
Member

asturur commented Jun 19, 2016

ie11 or ie edge?

@deepdoon
Copy link

IE 11. haven't checked it on edge.

@butch2k
Copy link

butch2k commented Jun 20, 2016

Same issue with chrome btw.

@deepdoon
Copy link

for me it worked fine with chrome. I am using chrome Version 51.0.2704.103

@awehring
Copy link

I can confirm the bug for IE 11 (exactly: 11.0.9600.18349) for deepdoons jsfiddle..

@asturur
Copy link
Member

asturur commented Jul 3, 2016

guys fiddle runs on 1.6.0-rc1

@asturur asturur closed this as completed Jul 3, 2016
@deepdoon
Copy link

deepdoon commented Jul 7, 2016

Hi @asturur it is still not working for IE11 using 1.6.0-rc1 and 1.6.3. Steps that i followed for http://jsfiddle.net/kg9weds5/8/ are:

  1. Open the link in IE11.
  2. Double click the text object to get it into edit mode.
  3. Select all text either by mouse or by pressing ctrl + A
  4. Once text is selected type any letter lets say 'd'.
  5. 'd' will not be displayed type another letter and that will get displayed.

So it is still skipping first letter in IE 11.

Thanks

@asturur
Copy link
Member

asturur commented Jul 7, 2016

ok i could replicate finally.
it does not get ignored. it leave one character from the old text instead of the one you pressed.

@asturur asturur reopened this Jul 7, 2016
@asturur asturur modified the milestones: 1.6.4, 1.6.3 Jul 7, 2016
@lambdazen
Copy link

Ran into this problem with IE11. Here's a JSFiddle test case: http://jsfiddle.net/ewu2u5dr/1/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.