question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using .sr-only inside a responsive table creates white space outside of body

See original GitHub issue

Description

Giving an element descended from .table-responsive the .sr-only class will cause the browser window to scroll horizontally due to .sr-only’s position: absolute.

I checked the docs and don’t see any limitations of using .sr-only listed. https://getbootstrap.com/docs/4.5/utilities/screen-readers/

Is there a workaround or can something be added to the docs?

Reduced test case

Reduce the browser width to its smallest and notice that the browser window scrolls, revealing white space to the right of the table. If you remove the .sr-only class from the top-right table cell, things behave normally.

https://www.codeply.com/v/0xzRkENQaH

Config

  • Bootstrap 4.5.2
  • macOS 10.15.7
  • Safari 14.0

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
patrickhlaukecommented, Dec 20, 2020

coming back to this a bit late, but: would adding the position: relative in bootstrap’s core CSS cause any other unforeseen problems? if not, we could probably add it directly.

are there any other situations where the .sr-only / .visually-hidden class would cause similar problems, do we know?

0reactions
mrlifecommented, Apr 25, 2022

If this is still an issue in v5, could this please be reopened and relabeled?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting white space on the right side on mobile device. Some ...
I'm getting strange white space on the right side of the mobile devices. I tried wrapping the page inside the body the following:...
Read more >
Responsive Data Tables | CSS-Tricks
We're going to use “responsive design” principles (CSS @media queries) to detect if the screen is smaller than the maximum squishitude of our ......
Read more >
Bootstrap 4 table responsive - examples & tutorial.
Table columns with text-nowrap. With the class . text-nowrap you can specify how white-space inside a table is handled. Sequences of white space...
Read more >
Getting Rid of Spaces in HTML Tables - ThoughtCo
Fix white-space problems with HTML tables by checking the HTML and relevant stylesheets but if you're using a table for page design, use...
Read more >
How To Create A Responsive Table - W3Schools
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, Python, PHP,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found