That function does a lot of things; modifying HTML elements, controlling tab order dynamically (via tabindex). This means that all the anchors are thrown into an array and I manually am moving the focus depending on the user tabbing, shift tabbing, or arrows.
The problem I have is that there are some cases where the plugin is called twice, and there’s nothing I can do about this. The solution here must be to somehow recognize the plugin has already ran once, somehow destroy all aspects of it, and let it re-run. How can I accomplish this? Do you need more information on the plugin? Thanks .
Sorry, it would not be. I could explain in detail, but you’ll have to trust me that we need the 2nd function to overwrite the first. Right now, running it twice causes slightly weird bugs.
The problem ultimately lies with the fact that our plugin has 2 options.
Let me back up and explain the function real fast. It works to make meganavs accessible. It takes 2 areas of a meganav; the description area (can hold links) and the <ul> link section (level2). This obviously has links.
The first call to the plugin adds all the links into an array based on using all the level2 links, and then description area links. Then, based on the order of the links added to the array, they get tabindex when the meganav is open on that menu item.
The issue arises on the 2nd plugin call, if they switch the order from level2 + description, to description + level2. If I just call the plugin twice, it’s no issue. It’s a niche case which I assume comes from the array I create and pushes the code into it.