Scroll rect of input fields wont scroll

I have a scrollrect which contains N panels, each of which have a large text input on them. This issue is that I cant scroll the list if I begin the swipe on a text input field, because it activates the input for text entry on the first mousedown and I cant get to the drag. Is there a simple way to give the drag priority over that first mousedown, preventing the input fields from activating right away? The only think I can think of at the moment is to turn interactable off on all the fields and then script turning one back on if theres a mouseup that doesnt come from a drag, but I’m hoping theres a cleaner method.

Thank you!

@Gmoff01
I recently created a script block that would resolve without having to create invisible buttons using only events. Apply this script to the InputField and drag the ScrollRect inside the Main Scroll script parameter and voila! :smiley:
I’m using Unity 2017.2.0p4

[108794-fixscrollrect.zip|108794]

That’s how you’ll have to do it. Check out IPointerClickHandler and the other interfaces in UnityEngine.EventSystems. You should be able to extend the InputField component and override the interface methods you need to get this to work. Something like if dragged then don’t select. But you’ll probably need to inspect the API’s DLL to figure out how to do it nicely. So it might be easiest to just have another event handler that activates the input field when necessary.

I was able to find a simple solution for this. I put a transparent button over the top of the input field. The button bubbles the drag event correctly, so the scroll rect still works. On button click, I call the input fields ActivateInputField() method, and all is well!

For anyone looking for the most up to date version, check out the code here.

@andrefjdesign Started out with a great foundation, but the code logic doesn’t work for input fields where the text field is the child of the input field (This is the default structure when creating an input field). The “onPointerDown” function failed to detect a valid click on an input field because the pointer eventData evaluated to “Text” and the object being compared with the pointer eventData is on the parent of the “Text”. Also, I setup variables to the input field, text object, and image once on Awake so the script isn’t constantly getting components every time it needs them.

@sushanta1991 Had a great solution as well that simply intercepted drag events and routed them back to the scroll rect. Unfortunately, it doesn’t account for on click events so while scrolling the user can still trigger and highlight input fields.