• Resolved annikaholovatsky

    (@annikaholovatsky)


    I have no experience with JS and very little experience with HTML, but when I first activated this plugin, the accordion items would stay open upon using the browser’s back function, that way users didn’t have to reopen all the items to resume browsing from where they last left off. I suspect this feature has stopped working due to a WordPress update or something, as I haven’t changed anything or added new plugins since I installed it.

    I have a tree of accordion items on my website serving as a sort of library of files, where users can browse different articles and files. However, to avoid having my users click to reopen each accordion item upon returning to the page, I’d like it so that the accordion items can stay open upon going back in the browser. Is there a way to make this possible again?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter annikaholovatsky

    (@annikaholovatsky)

    UPDATE 1:
    The back button seems to allow the accordions to stay open when using Mozilla Firefox, but not Microsoft Edge. I have yet to test in Chrome or Safari. I will update with findings after clearing my browser caches and seeing that makes a difference.

    UPDATE 2:
    Turns out, after clearing the cache from all my installed browsers, none of them remember which accordion items were open upon using the browser’s back button,including Firefox. This pretty much makes my current web page library too tedious to use, so I will need to figure out what is causing this problem. I’ll keep researching it. I’ll keep this topic updated with my findings/solution if I figure this out.

    Another note is that the accordion HTML anchor links don’t work either. They will either open the accordion, but won’t scroll to the opened item (unless you click it again or turn on the auto scroll option, which I would like to keep disabled) or in the case that it is a link to the HTML anchor from an external page, it will just load the accordion page with all the accordion items closed. It is a pretty frustrating situation, to be sure. I hope I find a solution that works soon. LOL

    UPDATE 3:
    So, it turns out that if a user is logged out, the accordion items will stay open upon using the back button (ONLY in Firefox, though. The other browsers do not seem to save the accordion open-closed status), though the HTML anchors are still not working as intended. I’m wondering if a recent browser update may have messed up this feature of the plugin? Or perhaps it is a conflict with Ultimate Members Plugin, since that is what I use as the infrastructure for my users account data. I’ll keep digging…

    Thread Starter annikaholovatsky

    (@annikaholovatsky)

    UPDATE 4:
    I’m not sure if this matters, but I noticed the plugin is untested with WordPress 6.0. Perhaps this is why the plugin stopped working for me? I’ll have to see what the changes between WordPress 5.9 and 6.0 are, in case there is some sort of conflict or change in functionality.

    Plugin Author philbuchanan

    (@philbuchanan)

    There is a lot to unpack here, but basically: this plugin does not do anything to support the back button, nor do I think it would be possible for me to add something like that. If a browser is remembering the accordion item state, that is only something the browser can store and restore.

    As for the anchor links, they _should_ be opening the correct accordion item. You may need to double check that you are using the correct IDs in both your accordion items and the links themselves. I have just tested again myself to confirm, and they are in fact working as intended.

    There is no meaningful different from WordPress 5.9 and 6.0 that would impact the functionality of this plugin on the frontend. I haven’t updated the plugin to reflect the testing, but it does work for me in WordPress 6.0.

    Thread Starter annikaholovatsky

    (@annikaholovatsky)

    Thanks for your response! It turns out that I may have figured out the culprit, but I’m not sure what’s causing it. The browser does seem to remember which accordions are active upon using the back button, but only if you aren’t logged in using an administrator user account. Not sure why this is, but it seems to be working fine for every other user, just not the admins. This includes the HTML anchor functionality when linking from another page back to the accordion items.

    I’m sure this is unrelated to your plugin, so it is nothing that you will need to fix. I’m happy with how responsive and easy to use your plugin is. Thanks for the continued support!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to get Accordions to stay open upon using Back button’ is closed to new replies.