rstudio / bslib

Tools for theming Shiny and R Markdown via Bootstrap 3, 4, or 5.
https://rstudio.github.io/bslib/
Other
443 stars 49 forks source link

refactor: `bslib_page_main()` instead of `bslib_sidebar_main()` #1059

Closed gadenbuie closed 1 month ago

gadenbuie commented 1 month ago

Follow up to #1057. I realized that the main page container that I added for page_sidebar() and page_navbar(sidebar=sidebar()) is something we will likely want to use in other contexts, ex. in page_navbar() without a sidebar, or in page_fillable() or in a theoretical page_dashboard() with/without a sidebar.

This PR updates the approach to be more generic:

The most controversial decision is switching from <div> to <main>. I think this is the right approach because the intent is to wrap the main content area and these PRs reveal that we know which container is the page's main container. I feel strongly that we should be adding a <main> landmark. But the downside is that there should only be one <main> tag on the page at a time, meaning we're making the decision for the user.

That said, it's very unlikely that a user is going to add a <main> landmark on their own and those who know about the need are also likely to use accessibility scanning tools which will surface our <main>.