Lightbox improvement - Drag navigation #1874

Closed
edijs wants to merge 10 commits from gitlab-mr-iid-604 into develop
Member

Closes #381

Closes #381
Author
Member

@feld , @hj please review this

@feld , @hj please review this
Member

can't this be done in template?

can't this be done in template?
Member

i don't like that video is being part of draggable. Will it conflict with dragging the seekbar?

i don't like that video is being part of draggable. Will it conflict with dragging the seekbar?
Member
  1. i think you can use empty canvas instead of empty image
  2. image is too big, better use a 1x1 gif in some minimal palette mode.
1. i think you can use empty canvas instead of empty image 2. image is too big, better use a 1x1 gif in some minimal palette mode.
Member

I don't think we really need to support drag events, only touch ones. Nobody really drags carousels on desktop. I think horizontal scroll is used far more often that dragging.

I don't think we really need to support drag events, only touch ones. Nobody really drags carousels on desktop. I think horizontal scroll is used far more often that dragging.
Owner

We need drag for mobile, though.

We need drag for mobile, though.
Author
Member

@feld @hj, ok just want to confirm.

  1. On desktop, horizontal scroll will navigate images but drag event
  2. On mobile, drag event will work for navigation
@feld @hj, ok just want to confirm. 1. On desktop, horizontal scroll will navigate images but drag event 2. On mobile, drag event will work for navigation
Author
Member

I have confirmed that video seek bar works good without conflict.

I have confirmed that video seek bar works good without conflict.
Member

it doesn't work without drag?

it doesn't work without drag?
Owner

Drag is a native mobile UX feature because it has a touch screen. If I see photos or a gallery on a mobile device or tablet the instinct is to drag, not look for a button element.

Drag is a native mobile UX feature because it has a touch screen. If I see photos or a gallery on a mobile device or tablet the instinct is to drag, not look for a button element.
Member

i'm not talking about UX, i'm talking about what sort of events browser fires

i'm not talking about UX, i'm talking about what sort of events browser fires
Owner

Do you mean "what happens if the mobile browser can't send drag events" ?

Do you mean "what happens if the mobile browser can't send drag events" ?
Member

no i mean "does browser send touch events, drag events or both?"

no i mean "does browser send touch events, drag events or both?"
Member

the answer is probably "touch events only, drag event after enormous delay and only if we don't react to touch event" btw, but i want a confirmation.

the answer is probably "touch events only, drag event after enormous delay and only if we don't react to touch event" btw, but i want a confirmation.
Author
Member

@hj , @feld can you please review the changes?

To say again,

  1. On desktop, horizontal mouse scroll will navigate images, but drag/drop won't work.
  2. On mobile, touch & drag will navigate gallery.
@hj , @feld can you please review the changes? To say again, 1. On desktop, horizontal mouse scroll will navigate images, but drag/drop won't work. 2. On mobile, touch & drag will navigate gallery.
Author
Member

No longer needed after removed drag event in desktop.

No longer needed after removed drag event in desktop.
Member

if you try dragging on desktop there's some weird side-effect on Chromium where the grabbed image moves with the cursor with gray edges depending on aspect ratio, there shouldn't be anything (which is how it works on firefox, which is good). Also the drag on mobile should use a way lower threshold, 100px is a lot especially when there's no feedback when you start dragging. I'd try something like 30-50px

if you try dragging on desktop there's some weird side-effect on Chromium where the grabbed image moves with the cursor with gray edges depending on aspect ratio, there shouldn't be anything (which is how it works on firefox, which is good). Also the drag on mobile should use a way lower threshold, 100px is a lot especially when there's no feedback when you start dragging. I'd try something like 30-50px
Author
Member

Fixed

Fixed
Member

Now the dragging doesn't work on mobile

Now the dragging doesn't work on mobile
Member

swiping works for me on firefox, however it's not intuitive that anything is going on, maybe sliding current picture would be a good improvement.

also background scrolls while you try to swipe making it even more confusing.

swiping works for me on firefox, however it's not intuitive that anything is going on, maybe sliding current picture would be a good improvement. also background scrolls while you try to swipe making it even more confusing.
Member

I tried it on my phone (firefox) and responsive design mode in both ff and chromium yesterday, haven't tried the newer version yet.

Doing animations for the images will be a more difficult thing considering there's just one image that changes instead of one moving away while other one comes in, I'd leave it for further improvements if deemed necessary.

I tried it on my phone (firefox) and responsive design mode in both ff and chromium yesterday, haven't tried the newer version yet. Doing animations for the images will be a more difficult thing considering there's just one image that changes instead of one moving away while other one comes in, I'd leave it for further improvements if deemed necessary.
Member

I don't think this is the approach we'd want.. isn't there a way to distinguish between mouse move events and touch events?

I don't think this is the approach we'd want.. isn't there a way to distinguish between mouse move events and touch events?
Member

Ok, it works with the newer version, one thing I'd add, check if Y movement is smaller than X or otherwise small enough, so it won't trigger the change when you do 35px on X and 80px on Y

Ok, it works with the newer version, one thing I'd add, check if Y movement is smaller than X or otherwise small enough, so it won't trigger the change when you do 35px on X and 80px on Y
Author
Member

No, we need to distinguish the browser to enable dragging. On desktop we catch only scroll events while touch event in mobile browser.

IMO, isMobileBrowser will be useful service for others.

No, we need to distinguish the browser to enable dragging. On desktop we catch only scroll events while touch event in mobile browser. IMO, `isMobileBrowser` will be useful service for others.
Author
Member

Implemented checking Y movement, and fixed background scroll.

Implemented checking Y movement, and fixed background scroll.
Member

Detecting browser is very bad practice, detect features support instead.

Detecting browser is very bad practice, detect features support instead.
Member

Keep in mind you can do touch on devices/browsers that aren't mobile as well. We don't care which browser the swipe was done on, we care if it was done using a touch or a mouse.

Keep in mind you can do touch on devices/browsers that aren't mobile as well. We don't care which browser the swipe was done on, we care if it was done using a touch or a mouse.

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pleroma/pleroma-fe!1874
No description provided.