-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Text inputs within sortable element #972
Comments
A possible solution would be to stop _onTapStart if the sender is a (text) input (this is code as of line 314):
This makes the text input usable as one would expect. Of course, this makes it impossible to drag the element by clicking into the text input. Maybe it would be sensible to add a switch to Please note that contentEditable Elements suffer the same issue. |
I am facing the same problem. I have a form with a series of subforms that are sortable. On Chrome, when I click on a subform , it gains the focus correctly and I can write inmediatly. On Firefox, the does not gain the focus. |
Try my answer: #997 |
Do we have any update here? |
Could you boil down the issue to saying that a |
Issue I believe stems from this checkin: #171 Ideally, we would just nix the // Bind events
if(window.PointerEvent){
_on(el, 'pointerdown', this._onTapStart);
} else {
_on(el, 'mousedown', this._onTapStart);
} With this block, we now only have one click event fired at a time, and we still support all the browsers, and we no longer need to have the |
Resolves: SortableJS#972 Related: SortableJS#1000 Removes duplicate “down” events and `preventDefault` operation on click events on “filter” items. This allows selection of things like text boxes and input elements that are inside a sortable element. Repro of bug: http://jsbin.com/cerumanoma/edit?html,js,output
Resolves: SortableJS#972 Related: SortableJS#1000 Removes duplicate “down” events and `preventDefault` operation on click events on “filter” items. This allows selection of things like text boxes and input elements that are inside a sortable element. Repro of bug: http://jsbin.com/cerumanoma/edit?html,js,output
I am afraid, the solution to use pointer instead of mousdown/touchstart would create a new problem: Users of older browsers would still have the old issue, and it would become harder to find the reason. And as you said: Mousedown/touchstart is only used to maintain compatibility. I am also not sure: Does prevention of bubbling really stop the other event from firing? It should not.
|
How would that solution create a new problem @BurninLeo? Specifically wrapping the Thoughts? |
@BurninLeo, in regards to click events and |
@AStoker, in my opinion, the fallback would (still) suffer the same issue like the current version. I think that generally it's a very good idea to use pointer events, but the fallback should be "safe" as well. Otherwise, you get crazy, tracking down bug reports that you cannot replicate. Also thanks for the JSFiddle demo. It works in Firefox and Chromium, but causes two events as soon as you use the iPhone Emulator in Chromium -> developer tools (I assume, it's the same in Chrome). And I guess that other old browser versions may behave the same way. And isn't it illogical that preventing one event from bubbling prevents another event from being fired? ;) |
@BurninLeo, how would the fallback (which is to use And not entirely. If the default event is a click, I could see how you'd want that to not use any other click events after. But in either case, it doesn't matter necessarily if I think it's illogical, it's the current behavior :) |
Possibly, I got the fallback wrong. I understood it that way that the fallback would include mousedown and touchstart, not only mousdown. If you removed touchstart (most touch devices support pointer events), I withdraw my point :) To my experience it's risky to rely on the "current behavior". As I wrote, it took me no longer then 2 minutes to find a browser configuration that worked differently. I assume that other browsers and mobile devices will show a different preventDefault behavior as well. This, however, does not affect the pointer solution. I would very much apprechiate the Sortable to receive that update! |
Try master and use |
@RubaXa My Hero ! |
Thank you @RubaXa, Firefox is a pain in the ass. |
Hi I'm not getting it working (with vuedraggable that uses SortableJS). Applying the solution
|
Hi it was a mistake from my side. Setting the attributes in Draggable worked. cf SortableJS/Vue.Draggable#841 (comment) |
Update & helpful addition to #972 (comment) for anyone who runs into this: It might make sense to filter all HTML form elements:
https://www.w3schools.com/html/html_form_elements.asp
|
@RubaXa would it perhaps make sense to add this to the README.md as "Form handling" FAQ or something like that? Also when reading this line in documentation: Just some thoughts to perhaps reopen this for enhanced documentation? |
There seems (still) to be an issue with text inputs in sortable elements, when using Firefox: When clicking a text input within a sortable element, the cursor won't jump to the position where I clicked.
Example: https://jsfiddle.net/3njqxn7k/
This issue relates to another two issues that have been closed: #629, #462
The text was updated successfully, but these errors were encountered: