pseudosavant / player.html

One file drop-in media player web app for using video and audio files served using basic HTTP directory listing
MIT License
219 stars 40 forks source link

Cannot click on subfolders in Firefox 96.0.2(Windows), Safari 15.2(macOS) #13

Closed noangel closed 2 years ago

noangel commented 2 years ago

Hello!

Tried to use this project and found a bug, when I click subfolder in Firefox or Safari it shows error in js console and click doesn't work:

Uncaught TypeError: e.path is undefined getTargetEl http://xxx/player.html:2603 clickLink http://xxx/player.html:2610

my folder structure: video folder/ --> some videos in it some videos player.html

It doesn't happen on Chrome-like browser. Anyone knows if that can be easily fixed? It would be nice to support Firefox, just curious if it's posibble, not a must have, thanks!

noangel commented 2 years ago

A solution:

2603c2603,2604
<           const anchors = [...e.path].filter((el) => el.nodeName === 'A');
---
>           const epath = e.path || (e.composedPath && e.composedPath());
>         const anchors = [...epath].filter((el) => el.nodeName === 'A');
3900c3901
< </html>

credits to https://stackoverflow.com/questions/39245488/event-path-is-undefined-running-in-firefox