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

Can't delete text after marking all #3661

Closed
MichaelJDK opened this issue Jan 31, 2017 · 20 comments · Fixed by #3759 or #8179
Closed

Can't delete text after marking all #3661

MichaelJDK opened this issue Jan 31, 2017 · 20 comments · Fixed by #3759 or #8179

Comments

@MichaelJDK
Copy link

Version

1.7.3

Test Case

https://jsfiddle.net/noeytn5x/

Steps to reproduce

Mark all the text inside the textfield and click the delete key (or any key really)

Expected Behavior

The text is deleted

Actual Behavior

Nothing happens

It however works fine if I mark all by double-clicking

@asturur
Copy link
Member

asturur commented Jan 31, 2017

i cannot replicate.
I have no delete button just the backspace since i m on a mac.
Can you replicate with backspace?
Can you replicate building the latest version on github? ( needs building the lib )

@MatBdry
Copy link

MatBdry commented Jan 31, 2017

I have the same issue. You can reproduce it if you try to delete the text in two steps. First select a part of the text, then click on delete key. Then, select the last remaining part, and try to delete it. It does not work.

@asturur
Copy link
Member

asturur commented Jan 31, 2017

Delete on PC or MAC?

@MatBdry
Copy link

MatBdry commented Jan 31, 2017

Delete PC. On Mac it works well

@entonbiba
Copy link

@asturur @mbaudry yea it lost focus once the delete button is clicked in the text and dragging to the end of the text.

This might be causing the issue

setSelectionStart: function(index) {
      index = Math.max(index, 0);
      this._updateAndFire('selectionStart', index);
    },

setSelectionEnd: function(index) {
      index = Math.min(index, this.text.length);
      this._updateAndFire('selectionEnd', index);
    },

@asturur
Copy link
Member

asturur commented Feb 2, 2017

still i cannot understand.
Can we have some more detail on reproduce? i cannot reproduce on windows neither.
OS, browser, key pressed

If we manage to replicate it by code is even better

@entonbiba
Copy link

@asturur selecting the full text and pressing delete doesn't remove it.
https://jsfiddle.net/noeytn5x/

This works:
image

This doesn't:
image

@MichaelJDK
Copy link
Author

For the record, backspace also doesn't delete the text.

@asturur
Copy link
Member

asturur commented Feb 14, 2017

i tried on macos vmware with windows 10. i cannot replicate.
Which browser anyway?

@MatBdry
Copy link

MatBdry commented Feb 14, 2017

I have the same problem on ubuntu 10.04 - Chrome 56

@entonbiba
Copy link

@asturur it happens on all browsers as long as you select the text using mouse. The only thing that can cause the issue is the selectionEnd. There is also this closed issue with the same problem #1402

setSelectionStart: function(index) {
      index = Math.max(index, 0);
      this._updateAndFire('selectionStart', index);
    },

setSelectionEnd: function(index) {
      index = Math.min(index, this.text.length);
      this._updateAndFire('selectionEnd', index);
    },

@asturur
Copy link
Member

asturur commented Feb 14, 2017

at time of issue number 1402 fabric was pretting different. i ll try again to replicate again. i have no luck.

@entonbiba
Copy link

@asturur I'll record a gif today

@asturur
Copy link
Member

asturur commented Feb 14, 2017

is not about gif, it does not mean i do not trust you.
i need a way to replicate it or i do not know what to fix

@entonbiba
Copy link

@asturur ok do the following

  1. click at the start of the text with your mouse
    image

  2. click and drag from the start to the end of the text and a bit outside it, now let go of the mouse click
    image

  3. press delete or backspace on your keyboard
    Nothing should happen since you have left the textbox input range or the selected text.

@ncou
Copy link
Collaborator

ncou commented Feb 15, 2017

Hi,

@entonbiba i can't reproduce it with your steps (PC => win7+chrome 56.0.2924.87).

But if i click at the end of the end of the text (red dot), and select all the text i can reproduce it.

  1. double click on the red dot
    2.Don't mouve the mouse, and press the left mouse button and select ALL the text & release your mouse press.
    3.Push DEL or SUPR button and the text is still remaining.

image

Hope it's help.

@asturur
Copy link
Member

asturur commented Feb 15, 2017

when you say press left button you mean mouse or keyboard?

@ncou
Copy link
Collaborator

ncou commented Feb 15, 2017

Hum, erratum, in fact it seems like when i select the text and release my selection with the cursor near the border of the jsfiddle, the itext component lose the focus and the delete press button doesn't work.

If i deselect the text in the same iframe all is working fine.

@asturur
Copy link
Member

asturur commented Feb 15, 2017

you may have centered the problem. that would be great

@asturur
Copy link
Member

asturur commented Mar 3, 2017

i wanted to fix this, i think the only way is hook up the event when you leave the canvas to behave as a mouseup.

ShaMan123 added a commit that referenced this issue Aug 25, 2022
fixes #8177 caused by #3759
and fixes #3661 that was the motivation for #3759

This issue was caused because the hiddenTextarea looses focus after mousedown.
So I have added a focus call in mousemove that fixes both issues.
ShaMan123 added a commit that referenced this issue Aug 25, 2022
backports #8179

fixes #8177 caused by #3759
and fixes #3661 that was the motivation for #3759

This issue was caused because the hiddenTextarea looses focus after mousedown.
So I have added a focus call in mousemove that fixes both issues.
frankrousseau pushed a commit to cgwire/fabric.js that referenced this issue Jan 6, 2023
fixes fabricjs#8177 caused by fabricjs#3759
and fixes fabricjs#3661 that was the motivation for fabricjs#3759

This issue was caused because the hiddenTextarea looses focus after mousedown.
So I have added a focus call in mousemove that fixes both issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants