-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Widget selection is not removed when widget is inside of a table cell #522
Comments
Hi, you're I tried to reproduce mentioned problem, but without proper effect. :(
Now selection should remain on the widget in 1st cell and text should not appear in 2nd cell? Am I understand you correct? Could you confirm that my approach to reproduction this problem is correct? Maybe I missed something? Browser: Chrome 59 |
I am now using Chrome 59 and see the same problem using my original test steps. Another variation. I plan on installing 4.7.1 into my app today. Hopefully the page with the demo is already running that version. |
Hi, thank you for better description. I was able to reproduce this situation here: https://codepen.io/msamsel/pen/BZrXxj?editors=1010.
Result: |
This issue: #520 might be related to this one. |
Are you reporting a feature or a bug?
Bug
Widgets have a selection mode. When they are clicked on, they get selected. When the insertion point or selected range is changed, they become unselected. This worked in 4.6.x.
When a widget is inside of a table cell (td), the selection mode fails to unselect when the creates an insertion point selection (range = collapsed). It fails to select when the cell ONLY contains the widget.
To reproduce:
The widget is established correctly.
Expected:
Widget becomes unselected.
Actual:
Widget stays selected, while the insertion point is active where you clicked.
Expected:
Typing to appear at the insertion point.
Actual:
Typing is ignored.
Other details
If you make a selected range in the other cell, unselection happens correctly.
If you omit text in the first cell, after pasting, you can click on the widget but it refuses to establish the selection.
I looked into the source code and can point out the issue.
selection.js/checkSelectionChange. This function now checks for fake selection support on tables through a call to isRealTableSelection. It does not test for fake selection used on widgets.
This is a proposed change:
if ( !realSel || ( !realSel.isHidden() && ((this.widgets.selected.length > 0) || !isRealTableSelection( realSel, sel )) ) ) {
However, I don't think its the right implementation because the fake selection engine should support user supplied selections. (I have created one for my installation.) Instead, I believe each consumer of fake selections should register a hook that is executed when realSel.isHidden() returns false. This will benefit users who are not using the tableselection plugin too.
The text was updated successfully, but these errors were encountered: