my17560 / dokuwiki-template-readthedokus

"Read the Docs" flavored DokuWiki template
MIT License
13 stars 9 forks source link

Top menu Breadcrumbs disappear when an anchor is selected #75

Closed goutnet closed 9 months ago

goutnet commented 9 months ago

Hi,

It seems the top breadcrumbs disappear when I select a section, here is an example, in a test page I created 2 sections:

image

This is displayed correctly in the URL does not have a #my_section in the end. But if A section is selected, this happens:

image

As you can see, the upper section (breadcrumbs and Edit) is gone :'(

my17560 commented 9 months ago

Hi.

When you click a section in the TOC, the content is scrolled to where the section is. I think you can scroll up to the top and breadcrumbs are there. If you can't scroll I need to investigate it.

goutnet commented 9 months ago

Unfortunately, we can not scroll up ^^;

On Mon, Dec 4, 2023, 18:01 Masaki Yasutake @.***> wrote:

Hi.

When you click a section in the TOC, the content is scrolled to where the section is. I think you can scroll up to the top and breadcrumbs are there. If you can't scroll I need to investigate it.

— Reply to this email directly, view it on GitHub https://github.com/my17560/dokuwiki-template-readthedokus/issues/75#issuecomment-1838206288, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3BAGYMH64DY4KX3ZZL4ALYHWNPRAVCNFSM6AAAAABAFKBWCSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZYGIYDMMRYHA . You are receiving this because you authored the thread.Message ID: @.***>

my17560 commented 9 months ago

That's weird, it never happened to me. Did you clean install Dokuwiki? Are you using some plugins?

goutnet commented 9 months ago

Yes we are using quite a few plugins, I can investigate that too, but I am not sure I have the bandwidth to do a clean install anytime soon ^^;

On Mon, Dec 4, 2023, 18:08 Masaki Yasutake @.***> wrote:

That's weird, it never happened to me. Did you clean install Dokuwiki? Are you using some plugins?

— Reply to this email directly, view it on GitHub https://github.com/my17560/dokuwiki-template-readthedokus/issues/75#issuecomment-1838219076, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA3BAG23MD7RVWZJSZMHRN3YHWOJPAVCNFSM6AAAAABAFKBWCSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMZYGIYTSMBXGY . You are receiving this because you authored the thread.Message ID: @.***>

my17560 commented 9 months ago

If you can list your plugins I'll test them on my computer. Or you can test by disabling all plugins and see if the bug still occurs.

goutnet commented 9 months ago

Hi,

here is the list of plugins we have installed on our production environment:

(ls lib/plugins):

clipboardutils                                                                                                                                                                                                              
codeclipboard                                                                                                                                                                                                               
comment                                                                                                                                                                                                                     
config                                                                                                                                                                                                                      
const                                                                                                                                                                                                                       
diagrams                                                                                                                                                                                                                    
diffpreview                                                                                                                                                                                                                 
do                                                                                                                                                                                                                          
drawio                                                                                                                                                                                                                      
edittable                                                                                                                                                                                                                   
extension                                                                                                                                                                                                                   
fastwiki                                                                                                                                                                                                                    
folded                                                                                                                                                                                                                      
gitlabapi                                                                                                                                                                                                                   
google_maps                                                                                                                                                                                                                 
ifauthex                                                                                                                                                                                                                    
iframe                                                                                                                                                                                                                      
imgpaste                                                                                                                                                                                                                    
include                                                                                                                                                                                                                     
index.html                                                                                                                                                                                                                  
indexmenu                                                                                                                                                                                                                   
info                                                                                                                                                                                                                        
logviewer                                                                                                                                                                                                                   
markdowku                                                                                                                                                                                                                   
move                                                                                                                                                                                                                        
newpagetemplate                                                                                                                                                                                                             
nspages                                                                                                                                                                                                                     
pagelist                                                                                                                                                                                                                    
plantumlparser                                                                                                                                                                                                              
popularity                                                                                                                                                                                                                  
revert                                                                                                                                                                                                                      
safefnrecode                                                                                                                                                                                                                
sectiontoggle                                                                                                                                                                                                               
sqlite                                                                                                                                                                                                                      
struct                                                                                                                                                                                                                      
styling                                                                                                                                                                                                                     
templatepagename                                                                                                                                                                                                            
upgrade                                                                                                                                                                                                                     
userhomepage                                                                                                                                                                                                                
usermanager                                                                                                                                                                                                                 
userpage                                                                                                                                                                                                                    
wrap

I am not sure if that would help ^̂^;

let us know :)

my17560 commented 9 months ago

That's quite a lot! I've installed all those plugins but sadly I couldn't reproduce the situation…Maybe depends on the plugin settings?

Is the sidebar shown when breadcrumbs are displayed correctly? If not, user custom styles might be the cause.

I’ll continue to investigate to reproduce the bug but it is better to test on your site, by disabling all the plugins or disabling user custom styles if possible.

goutnet commented 9 months ago

Hi, thanks for the hard work, I am thinking it might be in js code:

Here are steps to reproduce it at least on my end:

  1. Create a page with several sections (the page itself must be longer that can be displayed in one page)
  2. Edit one of the sections (e.g. using fastwiki)
  3. save
  4. you will be redirected to http://wiki/your/page#anchor (anchor being the section editted)

From there the top header is hidden.

If you directly connect onto the page itself: http://wiki/your/page#anchor (no editting required) the same behavior happens too.

I think the (maybe) impactful plugins would be markdown and fastwiki, but I doubt it.

Also, in the script.js:

/* DOKUWIKI:include js/readthedokus.js */                                                                                                                                                                                   

var dokus;                                                                                                                                                                                                                  
document.addEventListener("DOMContentLoaded", function() {                                                                                                                                                                  
        if (document.body.id === "dokuwiki__top") {                                                                                                                                                                         
                dokus = new ReadtheDokus();                                                                                                                                                                                 
                dokus.run();                                                                                                                                                                                                
        }                                                                                                                                                                                                                   
}); 

If I disabled the code here, the problem does not show up (still investigating).

my17560 commented 9 months ago

The function called _jumpToAnchor() is called to jump to the section. That must be conflicting with something. Are there any errors shown in Developer Mode's console?

goutnet commented 9 months ago

Might be related, but I do have an error here:

Failed to execute 'write' on 'Document': It isn't possible to write into a document from an asynchronously-loaded external script unless it is explicitly opened.
(anonymous) @ js.php?t=readthedokus&tseed=f5699ab5b0f63b30408d6a692b33949e:9

on the following line

document.write('<style type="text/css" media="screen"><!--/*--><![CDATA[/*><!--*/ .folded.hidden { display: none; } .folder .indicator { visibility: visible; } /*]]>*/--></style>');
goutnet commented 9 months ago

From a grep in the code, that was in the folded plugin, but even after disabling it, while the message is gone, the header problem still remains.

goutnet commented 9 months ago

Looking in the debugger, and adding a breakpoint in the _jumpToAnchor method, I see the following line seems to change the header height to 0:

        location.href = hash;

Seems after executing that line the header is gone.

goutnet commented 9 months ago

For information, for now I just comment this line to fix this issue … (which works) ^^;

https://github.com/my17560/dokuwiki-template-readthedokus/blob/main/js/readthedokus.js#L535

(clicking on the TOC still brings the section, and linking to the section too)…

With that said, I still have the problem after editting a section and cancel/save, seems a similar code must be somewhere too.

goutnet commented 9 months ago

I think I found the issue (even though the cause is not clear):

if my footer.html I had a code like this:

<div id="page_disclaimer">
     <div id="page_disclaimer_content" class="group">
    My Disclaimer here
     </div>
<div/>

in the header.html I had a style css to add a padding-top of 1.6em to the inner div. Removing that or replacing it with a margin-top instead fixes the issue.

So, I am going with this :)