Skip to content

Issue page resizing and TOC column width #2071

Closed

Description

@grimbough

I'm currently seeing an issue with the size of the floating table of contents and the main column of an html document. When the screen size is between 768px and 991px both elements fill the full width of the screen and overlap e.g.

image

It looks to me like the column layout naming uses the Bootstap 4 convention, but the transition between sm and md etc is being applied as if it is still Bootstrap 3. In the example above the page is 800px wide, but the style is still being treated as if it that should be called "small" rather than "medium".

The page above can be created with the following Rmd:

---
title: "Test columns"
author: "Mike Smith"
date: "3/12/2021"
output: 
  html_document:
    toc: true
    toc_float: true
---

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

I see this issue both with the package version from CRAN and installed today from GitHub.

> xfun::session_info()
R Under development (unstable) (2021-03-02 r80051)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Linux Mint 20, RStudio 1.4.1103

Locale:
  LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
  LC_MONETARY=de_DE.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=de_DE.UTF-8       LC_NAME=C                 
  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

Package version:
  base64enc_0.1.3   compiler_4.1.0    digest_0.6.27     evaluate_0.14     glue_1.4.2        graphics_4.1.0   
  grDevices_4.1.0   highr_0.8         htmltools_0.5.1.1 jsonlite_1.7.2    knitr_1.31        magrittr_2.0.1   
  markdown_1.1      methods_4.1.0     mime_0.10         rlang_0.4.10      rmarkdown_2.7.3   stats_4.1.0      
  stringi_1.5.3     stringr_1.4.0     tinytex_0.30      tools_4.1.0       utils_4.1.0       xfun_0.22        
  yaml_2.2.1 

By filing an issue to this repo, I promise that

  • I have fully read the issue guide at https://yihui.org/issue/.
  • I have provided the necessary information about my issue.
    • If I'm asking a question, I have already asked it on Stack Overflow or RStudio Community, waited for at least 24 hours, and included a link to my question there.
    • If I'm filing a bug report, I have included a minimal, self-contained, and reproducible example, and have also included xfun::session_info('rmarkdown'). I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version: remotes::install_github('rstudio/rmarkdown').
    • If I have posted the same issue elsewhere, I have also mentioned it in this issue.
  • I have learned the Github Markdown syntax, and formatted my issue correctly.

I understand that my issue may be closed if I don't fulfill my promises.

Activity

  1. apreshill commented on Mar 12, 2021

    @apreshill
    Contributor

    Seeing similar here in the RStudio IDE viewer:

    Screen Shot 2021-03-12 at 12 18 54 PM

    Screen Shot 2021-03-12 at 12 19 09 PM

    Screen Shot 2021-03-12 at 12 18 42 PM

  2. cderv commented on Mar 12, 2021

    @cderv
    Collaborator

    This definitely comes from the change in #1706 (64072eb), confirm by a git bisect.

    I believe this is this addition regarding toc float https://github.com/rstudio/rmarkdown/pull/1706/files#diff-91b59569aab1b937e1e5a6e1559a62de19e04f4c4bad52bfb08b910281e0f2dfL504-R459

    --- a/inst/rmd/h/default.html
    +++ b/inst/rmd/h/default.html
    @@ -501,8 +439,12 @@
     $if(toc_float)$
     
     <!-- setup 3col/9col grid for toc_float and main content  -->
    -<div class="row-fluid">
    +<div class="row">
    +$if(bs3)$
     <div class="col-xs-12 col-sm-4 col-md-3">
    +$else$
    +<div class="col-sm-12 col-md-4 col-lg-3">
    +$endif$
     $if(toc-title)$
     <h2 id="$idprefix$toc-title">$toc-title$</h2>
     $endif$
    @@ -510,7 +452,11 @@ <h2 id="$idprefix$toc-title">$toc-title$</h2>
     </div>
     </div>
     
    +$if(bs3)$
    +<div class="toc-content col-sm-12 col-md-8 col-lg-9">
    +$else$
     <div class="toc-content col-xs-12 col-sm-8 col-md-9">
    +$endif$
     
     $endif$

    which cause bootstrap 3 rules to apply where it were not before like

    @media (min-width: 768px)
    .col-sm-12 {
        width: 100%;
    }

    This will require some CSS tweaks and testing for BS4 and BS3.

    cc @cpsievert if you know what to do.

  3. added
    bug
    on Mar 12, 2021
  4. cpsievert commented on Mar 12, 2021

    @cpsievert
    Contributor

    Thanks for bisecting @cderv. See #2072 for a fix

  5. cderv commented on Mar 12, 2021

    @cderv
    Collaborator

    Thanks for the fix. It is a shame that I missed this in the PR review as it is an impactful change, and an easy detectable inversion of line.

  6. github-actions commented on Sep 14, 2021

    @github-actions

    This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

  7. locked as resolved and limited conversation to collaborators on Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions