IgniteUI / ignite-ui

Ignite UI for jQuery by Infragistics
https://bit.ly/2kuu1fT
Other
477 stars 83 forks source link

igTextEditor selects all the text when the browser window gets focused again #2076

Closed ymita closed 4 years ago

ymita commented 4 years ago

Description

If the first character is contained as selected text on igTextEditor, it selects all the text when the browser window gets focused again. igTextEditor's selectionOnFocus option is set to "browserDefault", and the result between igTextEditor and input(or textarea) is different.

Steps to reproduce

  1. Run the sample
  2. Select some characters - make sure the first character is also selected
  3. Switch to other window
  4. Switch back to the browser

Result

All the characters are selected.

Expected result

Selected characters remain the same.

Note

On Line 3692, If I change the first if statement as if (startPosition >= 0) instead of if (startPosition), the behavior above is solved. https://github.com/IgniteUI/ignite-ui/blob/master/src/js/modules/infragistics.ui.editors.js#L3692

Attachments

igTextEditor selection behavior.zip

editor-selection

ymita commented 4 years ago

There is another case that selects all the text upon igTextEditor focus.

Steps

  1. Set the caret before the first character
  2. Switch to other window
  3. Switch back to the browser

Actual result

All the characters on the editor are selected.

Expected result

No character is selected and the caret remains before the first character.