dromru / react-photoswipe-gallery

🏙 React component wrapper around PhotoSwipe
https://dromru.github.io/react-photoswipe-gallery/
MIT License
514 stars 28 forks source link

Custom content not getting events #954

Closed tjg184 closed 1 year ago

tjg184 commented 2 years ago

Is your feature request related to a problem? Please describe.

With custom content for an Item, any input controls are disabled on that content. I'm speculating it has to do with the swipe input or some other event listener. There may be a way around this, but am writing up for any help. This could be a bug too, but I was thinking most of the content here was maybe expected to be just "read-only" type content.

Example:

On MyCustomControl, all events are being passed to the actual gallery and effectively are disabled on the custom content. On this example MyCustomControl has a simple input box.

<Item {<MyCustomControl photo={ item } /> }

Describe the solution you'd like

Allow events to be passed to the custom content.

Describe alternatives you've considered

I've tried experimenting with several options on the actual Gallery instance.

irudoy commented 2 years ago

Take a look at https://photoswipe.com/custom-content/

Please note that PhotoSwipe is mainly designed to display photos. There are issues with displaying other types of content - for example, you can't swipe over iframes.

You can try to prevent some internal handling of events, like this:

<Gallery
  onBeforeOpen={(pswp) => {
    pswp.on('pointerDown', (e) => e.preventDefault())
    // pswp.on('pointerMove', (e) => e.preventDefault())
    // pswp.on('pointerUp', (e) => e.preventDefault())
    // pswp.on('pinchClose', (e) => e.preventDefault())
    // pswp.on('verticalDrag', (e) => e.preventDefault())
  }}
>
Poylar commented 1 year ago

I want to reopen this issue as I encountered the same problem in Safari. If the custom content is html video, then the functions of rewinding, changing sound, etc. do not work only on safari. The solution above works, but it also disables half of the gallery functionality, which is not very good. Are there any other options to leave the swipe and video control functionality in Safari?