dokuwiki / dokuwiki

The DokuWiki Open Source Wiki Engine
http://www.dokuwiki.org
GNU General Public License v2.0
4.18k stars 853 forks source link

Lightbox is broken on dokuwiki.org #4328

Open sersorrel opened 1 month ago

sersorrel commented 1 month ago

The problem

The lightboxes on pages like https://www.dokuwiki.org/template don't work: they open a modal interface, but it's blank, with only a close button in the top-right.

I also see this behaviour on other DokuWiki sites, e.g. https://andreashaerter.com/projects/dokuwiki-template-mnml-blog, and I think I have seen it with other browsers too.

When the problem occurs, I see network requests to https://www.dokuwiki.org/null (or similar addresses ending in /null). Firefox thinks these come from an openImage function called by something inside SimpleLightbox. It seems like the problem has to do with the line var targetURL = element.getAttribute(this.options.sourceAttr); this.options.sourceAttr is "data-url", but element is an <a> with only an href attribute.

I don't know where the lightbox options are set, GitHub search turns up almost nothing for this code and all I know is it's being served by /lib/exe/js.php (I can't even tell if this is coming from DokuWiki core or a (built-in?) plugin or what), but I presume that DokuWiki should be telling its lightbox to read the href attribute, not the data-url attribute?

I'm sorry I can't produce any more useful information.

Version of DokuWiki

?

PHP Version

?

Webserver and version of webserver

No response

Browser and version of browser, operating system running browser

Firefox 130, Linux

Additional environment information

No response

Relevant logs and/or error messages

No response

fiwswe commented 1 month ago

I can reproduce on https://www.dokuwiki.org/template, but it seems to me that this would be an issue with the internal Repository Plugin, not DokuWiki itself?

Or maybe some other plugin is involved in displaying the lightbox? Possibly the Gallery Plugin?

FWIW: Tested on Safari 18.0.1 and Brave Version 1.70.123 Chromium: 129.0.6668.89 (arm64) with same results.

sersorrel commented 1 month ago

ah! I see the relevant code in the gallery plugin, thank you for the suggestion: https://github.com/splitbrain/dokuwiki-plugin-gallery/blob/934fd4d1b4b464d722648b41fe8ca0e140d58298/simple-lightbox/simple-lightbox.js#L1166

it defines the default for sourceAttr as "href": https://github.com/splitbrain/dokuwiki-plugin-gallery/blob/934fd4d1b4b464d722648b41fe8ca0e140d58298/simple-lightbox/simple-lightbox.js#L31-L32

but then later it passes "data-url" explicitly: https://github.com/splitbrain/dokuwiki-plugin-gallery/blob/934fd4d1b4b464d722648b41fe8ca0e140d58298/script.js#L62

I guess somehow the branch where it sets $a['data-url'] is not always executed? https://github.com/splitbrain/dokuwiki-plugin-gallery/blob/934fd4d1b4b464d722648b41fe8ca0e140d58298/classes/XHTMLFormatter.php#L133

fiwswe commented 1 month ago

If you are sure that this is caused by the Gallery Plugin then please open an issue in its issue tracker and close the one here.

I don't use the Gallery Plugin but it would probably be good to include a simple reproducible test case, preferably without the Repository Plugin, if that is possible.

sersorrel commented 1 month ago

well, my point is that I don't know if it's caused by the gallery plugin: perhaps it's just misconfigured on dokuwiki.org, I have no way of knowing. I do not use the plugin on my own wiki.

I would assume that the plugin is not completely broken for everyone or someone would have noticed earlier...