nomadjimbob / mikio

Customizable, Bootstrap 4 inspired template for Dokuwiki
GNU General Public License v2.0
22 stars 6 forks source link

action links don't work at all #57

Closed schplurtz closed 6 months ago

schplurtz commented 7 months ago

Hi,

I just installed mikio template and plugin on a test wiki. Action links in the menus don't work. For example, I cannot log in. Clicking on user menu effectively drops down the menu as shown below, but clicking on "Log in" does nothing. Tested with both firefox and brave. You can see the problem by yourself on my test wiki. This wiki is to be deleted on 20th December 2023.

If I open the "Log in" (or other action) link in another tab, it works. So the link is correct and the wiki responds well to the query. But a standard click does nothing.

image

In the browser console there are two javascript error messages when the page loads. I don't know if it's related. The first one is caused by the use of $ instead of JQuery. Dokumentation states that javascript should not use $ as a shortcut for JQuery. The second error is a consequence of the first.

Uncaught TypeError: $ is undefined
    <anonymous> https://pamarei1zai7phaop.bidule.https443.net/lib/tpl/mikio/assets/mikio-typeahead.js:695
    <anonymous> https://pamarei1zai7phaop.bidule.https443.net/lib/tpl/mikio/assets/mikio-typeahead.js:37
    <anonymous> https://pamarei1zai7phaop.bidule.https443.net/lib/tpl/mikio/assets/mikio-typeahead.js:40
Uncaught TypeError: jQuery(...).typeahead is not a function
    typeahead https://pamarei1zai7phaop.bidule.https443.net/lib/tpl/mikio/assets/mikio.js:681
    ready https://pamarei1zai7phaop.bidule.https443.net/lib/tpl/mikio/assets/mikio.js:26
    <anonymous> https://pamarei1zai7phaop.bidule.https443.net/lib/tpl/mikio/assets/mikio.js:781
    EventListener.handleEvent* https://pamarei1zai7phaop.bidule.https443.net/lib/tpl/mikio/assets/mikio.js:781
nomadjimbob commented 7 months ago

Thanks for reporting however I am not seeing this issue on a clean install of Dokuwiki (2023-04-04a Jack) using Firefox 120.0.1, however I can see it failing on your test website.

Can you provide a screenshot of the plugins you have installed and version of Dokuwiki so I can try and replicate the problem?

Attached is a replacement mikio-typeahead.js (an external library used by the template) file with jQuery used in compatibility mode. Hopefully this fixes the problem, but I cannot be certain as I can't get it to fail. You will need to rename the file from mikio-typeahead.txt to mikio-typeahead.js (Github doesn't allow uploads of JS files in comments.

mikio-typeahead.txt

schplurtz commented 6 months ago

I reinstalled the wiki with mikio template and plugin being the only extensions. Problem persists.

What I had forgotten, is that is uses the current dev snapshot.

With stable DokuWiki, mikio actions work well, the jQuery error does not appear in console.

Sorry. I should have remembered.

nomadjimbob commented 6 months ago

The typeahead script is loading before jQuery as jQuery is deferred by DokuWiki since Hogfather. Mikio checks the Dokuwiki version and does the same, however snapshots return a version of 0, so Mikio treats this as before hogfather, doesn't defer script loading and fails.