Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Merged
merged 3 commits into from
May 29, 2024

Conversation

gadenbuie
Copy link
Member

@gadenbuie gadenbuie commented May 29, 2024

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:

  • Creates main.bslib-page-main for the container (instead of .bslib-page-sidebar-main)
  • Uses .bslib-page-main as the CSS class (instead of .bslib-page-sidebar-main)
  • bslib-page-main-min-{width,height} for the Sass/CSS variables (instead of bslib-page-sidebar-main-min-{width,height}).

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>.

gadenbuie added 2 commits May 29, 2024 16:17
* Creates `main.bslib-page-main` for the container
* Uses `.bslib-page-main` as the CSS class
* `bslib-page-main-min-{width,height}` for the Sass/CSS variables
@gadenbuie gadenbuie requested a review from cpsievert May 29, 2024 20:24
@gadenbuie gadenbuie merged commit 55b90f8 into main May 29, 2024
1 check passed
@gadenbuie gadenbuie deleted the chore/page-main-container branch May 29, 2024 20:36
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants