-
Notifications
You must be signed in to change notification settings - Fork 218
Closed
Labels
Milestone
Description
Currently, title and subtitle arguments in gt::tab_header() are rendered as <th> tag for html output.
However, please use <td> and just rely on css for their visual aspects.
<th> is semantically associated with either column or row headers, so using <th> tag for title and subtitle causes significant confusion for assistive technologies (e.g., screen readers or robots).
Now that we surround title and subtitle inside <thead>, that suffices.
Reprex
# Load package
library(gt)
# Create gt table with title and subtitle
airquality[1:10, ] %>%
gt::gt() %>%
gt::tab_header(
title = "Title",
subtitle = "Subtitle"
)
| Title | |||||
|---|---|---|---|---|---|
| Subtitle | |||||
| Ozone | Solar.R | Wind | Temp | Month | Day |
| 41 | 190 | 7.4 | 67 | 5 | 1 |
| 36 | 118 | 8.0 | 72 | 5 | 2 |
| 12 | 149 | 12.6 | 74 | 5 | 3 |
| 18 | 313 | 11.5 | 62 | 5 | 4 |
| NA | NA | 14.3 | 56 | 5 | 5 |
| 28 | NA | 14.9 | 66 | 5 | 6 |
| 23 | 299 | 8.6 | 65 | 5 | 7 |
| 19 | 99 | 13.8 | 59 | 5 | 8 |
| 8 | 19 | 20.1 | 61 | 5 | 9 |
| NA | 194 | 8.6 | 69 | 5 | 10 |
Created on 2020-11-07 by the reprex package (v0.3.0.9001)
Session info
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#> setting value
#> version R version 4.0.3 (2020-10-10)
#> os Windows 10 x64
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_United States.1252
#> ctype English_United States.1252
#> tz America/New_York
#> date 2020-11-07
#>
#> - Packages -------------------------------------------------------------------
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.3)
#> backports 1.1.10 2020-09-15 [1] CRAN (R 4.0.3)
#> checkmate 2.0.0 2020-02-06 [1] CRAN (R 4.0.3)
#> cli 2.1.0 2020-10-12 [1] CRAN (R 4.0.3)
#> colorspace 1.4-1 2019-03-18 [1] CRAN (R 4.0.3)
#> crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.3)
#> digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.3)
#> dplyr 1.0.2 2020-08-18 [1] CRAN (R 4.0.3)
#> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.3)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.3)
#> fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.3)
#> fs 1.5.0 2020-07-31 [1] CRAN (R 4.0.3)
#> generics 0.1.0 2020-10-31 [1] CRAN (R 4.0.3)
#> ggplot2 3.3.2 2020-06-19 [1] CRAN (R 4.0.3)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.3)
#> gt * 0.2.2 2020-11-07 [1] Github (rstudio/gt@6287519)
#> gtable 0.3.0 2019-03-25 [1] CRAN (R 4.0.3)
#> highr 0.8 2019-03-20 [1] CRAN (R 4.0.3)
#> htmltools 0.5.0.9002 2020-11-01 [1] Github (rstudio/htmltools@0741213)
#> knitr 1.30.2 2020-10-25 [1] local
#> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.3)
#> magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.3)
#> munsell 0.5.0 2018-06-12 [1] CRAN (R 4.0.3)
#> pillar 1.4.6 2020-07-10 [1] CRAN (R 4.0.3)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.3)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.3)
#> R.cache 0.14.0 2019-12-06 [1] CRAN (R 4.0.3)
#> R.methodsS3 1.8.1 2020-08-26 [1] CRAN (R 4.0.3)
#> R.oo 1.24.0 2020-08-26 [1] CRAN (R 4.0.3)
#> R.utils 2.10.1 2020-08-26 [1] CRAN (R 4.0.3)
#> R6 2.5.0 2020-10-28 [1] CRAN (R 4.0.3)
#> rappdirs 0.3.1 2016-03-28 [1] CRAN (R 4.0.3)
#> rematch2 2.1.2 2020-05-01 [1] CRAN (R 4.0.3)
#> reprex 0.3.0.9001 2020-10-25 [1] Github (tidyverse/reprex@d3fc4b8)
#> rlang 0.4.8 2020-10-08 [1] CRAN (R 4.0.3)
#> rmarkdown 2.5.3 2020-11-04 [1] Github (rstudio/rmarkdown@bb7d952)
#> sass 0.2.0.9005 2020-11-04 [1] Github (rstudio/sass@fef1d25)
#> scales 1.1.1 2020-05-11 [1] CRAN (R 4.0.3)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.3)
#> stringi 1.5.3 2020-09-09 [1] CRAN (R 4.0.3)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.3)
#> styler 1.3.2 2020-02-23 [1] CRAN (R 4.0.3)
#> tibble 3.0.4 2020-10-12 [1] CRAN (R 4.0.3)
#> tidyselect 1.1.0 2020-05-11 [1] CRAN (R 4.0.3)
#> vctrs 0.3.4 2020-08-29 [1] CRAN (R 4.0.3)
#> withr 2.3.0 2020-09-22 [1] CRAN (R 4.0.3)
#> xfun 0.19.3 2020-11-06 [1] Github (yihui/xfun@12e77f5)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.3)
#>
#> [1] C:/Program Files/R/R-4.0.3/library