Tab doesn't get activated when clicking on a header in table of contents

Hi,

I'm creating a html document with tabs and floating table of content. Both of them appear fine, but when a section is clicked via toc that belongs to an inactive tab, the document only scrolls up. Not sure if it's intended to work this way or just a bug? Any help on being able to activate the correct tab and navigate directly to the clicked section via table of contents would be greatly appreciated.

Reference code below:


title: test
output:
html_document:
toc: true
toc_float: true
toc_highlight: true
toc_depth: 3
number_sections: true


With the chunk option results = 'asis', you can
write out text as raw Markdown content, which can
also be mixed with plots.

Contents {.tabset}

Tab 1 {#tab1}


for (i in names(mtcars)) {
  cat('\n\n### Summary of the variable `', i, '`\n\n')
  x <- mtcars[, i]
  if (length(unique(x)) <= 6) {
    cat('`', i, '` is a categorical variable.\n\n')
    plot(table(x), xlab = i, ylab = 'Frequency', lwd = 10)
  } else {
    cat('Histogram for the continuous variable `', i, '`.\n\n')
    hist(x, xlab = i, main = '')
  }
}

Tab 2 {#tab2}


for (i in names(mtcars)) {
  cat('\n\n### Summary of the variable s `', i, '`\n\n')
  x <- mtcars[, i]
  if (length(unique(x)) <= 6) {
    cat('`', i, '` is a categorical variable.\n\n')
    plot(table(x), xlab = i, ylab = 'Frequency', lwd = 10)
  } else {
    cat('Histogram for the continuous variable `', i, '`.\n\n')
    hist(x, xlab = i, main = '')
  }
}

Could it be related to this issue ?

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.