Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Stop tocbot appearing over content on mobile #47

Closed
yorkshire-pudding opened this issue Sep 14, 2022 · 4 comments · Fixed by #48
Closed

Stop tocbot appearing over content on mobile #47

yorkshire-pudding opened this issue Sep 14, 2022 · 4 comments · Fixed by #48
Assignees
Labels
bug Something isn't working

Comments

@yorkshire-pudding
Copy link
Contributor

On mobiles, Tocbots placed in sidebars appear on top of the content. Following discussion over #43 it was decided that to fix the immediate bug we should stop the tocbot block appearing over content.

#43 will remain open to try to implement a pattern that allows that ToC to be used wherever the user is in the content.

@olafgrabienski
Copy link
Member

Thanks for the PR! I've tested the change and found out it works only for screens at least 769px wide. To make it work for 768px (e.g. for iPads in portrait mode), I'd suggest to set position: relative without media query condition. Then add a min-width media query to set position: fixed.

@olafgrabienski
Copy link
Member

This works for me:

.js-toc-block.is-position-fixed {
  position: relative !important;
}

@media (min-width: 48em) {
  .js-toc-block.is-position-fixed {
    position: fixed !important;
    top: 80px;
    max-width: 150px;
  }
}

Notes re this approach:

  • In the first part, I guess we don't need to unset the top value.
  • In the second part, I have integrated the changes in the existing media query.

@yorkshire-pudding
Copy link
Contributor Author

Thanks @olafgrabienski - that makes sense. PR updated

olafgrabienski added a commit that referenced this issue Sep 15, 2022
Fixes #47 removes position:fixed and top offset
@olafgrabienski
Copy link
Member

Thanks a lot, @yorkshire-pudding – I've merged the PR after the last changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants