hyperlinktabsdojotabcontainer

Dojo Tabs - Populating w/ HTML/JS & Anchor links


I'm developing a web application that is making use of tabs. I've run one issue that seems small, but I haven't been able to locate a solution and I'm worried it is indicative of larger problems with my code.

My application has one main page that includes a tab container with several content panes then inserted as children. I figured that having each content pane load an external HTML file and loading it that way was a good solution - it seemed to provide modular design and allow for easy changing of the contents of an individual tab. The issue I am running into now is that while everything loads correctly, I'm unable to provide anchor links in inside a tab or between tabs. Here is some sample code:

var tabs = new TabContainer({
    style: "height: 100%; width: 100%;" 
}, "tab-container");
tabs.startup();
var metadata = new ContentPane({
    title: "Metadata",
    id: "Metadata"
});
/* repeat for the non-metadata content panes */
request.get("/js/viewer/templates/splash.html").then(function (results) {
    splash.set("content", results);
});
/* repeat for each pane */

For my metadata page I want it to contain information about the datasets I am providing to users. Ideally, it would have a table of contents with anchor links to the proper entries. However, when I implement an anchor link, like so:

<a href="#test">Click me to jump down the page!</a>
<!-- some content here -->
<div id="test">We made it!</div>

The link is clickable and it does in fact bring you to the proper location, but it seems to invariably load this in a new frame that requires a user to reload the page if they wish to do anything else. I've tried playing with tag properties but it's been to no avail. I'm also hoping to be able to link between tabs (say, if a user is querying on one of the query pages I have presented them and then wants to know where a dataset came from or other information).

Here is a simple imgur album showing what happens: https://i.sstatic.net/I1HgA.jpg

After clicking the link in the first image, you're sent down the page. However, the tab bar and the navigation bar of the page disappear completely, even when you scroll back up. I don't know why this is.

So, this has been a long question, but here is the core of it:

What am I doing wrong with anchor links?


Solution

  • In my case, this behavior seems to be caused by interaction of the overflow: hidden CSS property of my website's body interacting with the height: 100% property of my tab container. I didn't realize that the overflow: hidden property was set because it was part of a framework I was using. By changing the overflow property I have been able to achieve the desired behavior.