bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Adding .visually-hidden to table results in it taking up space

Open philgyford opened this issue 2 months ago • 1 comments

Prerequisites

Describe the issue

If I apply the visually-hidden class to a <table> element then in some browsers it appears to take up space still, resulting in scrollbars, even though the table isn't visible.

  1. Create a page with a <table class="visually-hidden"></table> element.
  2. Add enough contents to it that it would be longer than the page

On macOS, in Safari 26.0.1 and Chrome 141.0.7390.55 I see this problem. Firefox 141 does not exhibit the issue.

Reduced test cases

Here's a codepen - see the vertical scrollbar in the apparently empty main area: https://codepen.io/philgyford/pen/dPGNyoE

What operating system(s) are you seeing the problem on?

macOS

What browser(s) are you seeing the problem on?

Chrome, Safari

What version of Bootstrap are you using?

v5.3.8

philgyford avatar Oct 04 '25 16:10 philgyford

interesting find... looks like adding this CSS works as a workaround.

.visually-hidden > * {
  max-height: 0;
  display: inline-block;
}

coliff avatar Oct 10 '25 03:10 coliff