dragdealer icon indicating copy to clipboard operation
dragdealer copied to clipboard

Input inside carousel

Open 4ega opened this issue 9 years ago • 11 comments

I have a tabs navigation with dragdealer, each page is a carousel item. The issue is when I use inside tabs, I can't select it. Click on inputs does nothing. You can reproduce that in any demo, by adding some input inside it. Is there some way to have inputs inside dragdealer elements?

4ega avatar May 19 '15 11:05 4ega

Is there some way to have inputs inside dragdealer elements?

I've never tested for this, since draggable surfaces are usually less interactive. Clicking on links works, so theoretically clicking the input should also work if you click still (don't drag from mousedown to mouseup). This is the relevant code: https://github.com/skidding/dragdealer/blob/master/src/dragdealer.js#L458-L467

You could maybe add the form on top of the handle and position it in tandem with the Dragdealer handle using animationCallback. See the "Content scroller" demo for inspiration, where you synk the scrollable area with the slider on the right: http://skidding.github.io/dragdealer/#just-a-slider – You could use the same concept but put your form with inputs on top of the draggable carousel.

ovidiuch avatar May 19 '15 21:05 ovidiuch

Hi,

I have the same problem. Input fields within the slides do not work. I tried to disable the event handlers you mentioned in the JS file, but it doesn't seem related.

When I use a text input field with a label inside the carousel you can't select the input with a click. But when you click on the label the input gets focused/selected.

Any help in solving this would be appreciated.

Thanks, Florian

florianbepunkt avatar Oct 23 '15 11:10 florianbepunkt

Hi, I have done this in really nasty way here

Works for me at least )

4ega avatar Oct 23 '15 11:10 4ega

Thanks I tried your commit but it didn't work. What really confuses me is that the input gets selected when I click on the label

florianbepunkt avatar Oct 23 '15 16:10 florianbepunkt

I think a cool Dragdealer feature for this would be to a dragdealer-skip class for elements inside the .handle that you want to preserve native events and not be draggable. This way you could wrap all your interactive content (forms, links, etc) under .dragdealer-skip and dragdealer would pass through and ignore events that are received for a child node of .dragdealer-skip.

Never had time to implement this. If someone thinks this is a good idea and is willing to contribute I'm willing to validate an implementation proposal and then code review code added.

ovidiuch avatar Oct 29 '15 20:10 ovidiuch

Has anyone by any chance taken a look at this? I did try to figure out how you set up your plugin but I'm not familiar with your structure (I have edited/created a few plugins myself but they were all structured differently)

mariusjp avatar Feb 17 '16 14:02 mariusjp

i did a very complex slider witch in my opinion dragdealer wasn't suposed to work that way, but it did!! and for my surprise it worked greatly with your implementation @4ega , it was really helpfull i was selecting the inputs with jquery .focus(); whenever there was an input inside the handler, that was really nasty.. i think your implementation should be implemented with a global var named "handleInputs" in the dragdealer's main branch

VagnerDomingues avatar Feb 22 '16 23:02 VagnerDomingues

This is how I got mine working: Commit on fork

mariusjp avatar Feb 27 '16 10:02 mariusjp

This problem is cause by the hooks not being set/released correctly. Also the animation frame never stops.

asdf23 avatar May 27 '16 13:05 asdf23

@MJTheOne that's cool. If you feel like contributing upstream I'll try to find time code review your patch. Others here might as well.

@asdf23 how so? I think it has more to do with knowing what's a drag target and what not.

ovidiuch avatar May 29 '16 14:05 ovidiuch

@skidding Did you ever get a chance to fix this? It still appears to be an issue.

dandxc avatar Feb 26 '23 03:02 dandxc