prevent tab group safari twitch; fixes #1839

pull/1880/head
Cory LaViska 2024-02-20 14:58:11 -05:00
rodzic b589938443
commit e1102ba9cf
2 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -18,6 +18,7 @@ New versions of Shoelace are released as-needed and generally occur when a criti
- Fixed a bug in `<sl-rating>` that caused the rating to not reset in some circumstances [#1877]
- Fixed a bug in `<sl-select>` that caused the menu to not close when rendered in a shadow root [#1878]
- Fixed a bug in `<sl-tree>` that caused a new stacking context resulting in tooltips being clipped [#1709]
- Fixed a bug in `<sl-tab-group>` that caused the scroll controls to toggle indefinitely when zoomed in Safari [#1839]
## 2.14.0

Wyświetl plik

@ -338,8 +338,13 @@ export default class SlTabGroup extends ShoelaceElement {
if (this.noScrollControls) {
this.hasScrollControls = false;
} else {
// In most cases, we can compare scrollWidth to clientWidth to determine if scroll controls should show. However,
// Safari appears to calculate this incorrectly when zoomed at 110%, causing the controls to toggle indefinitely.
// Adding a single pixel to the comparison seems to resolve it.
//
// See https://github.com/shoelace-style/shoelace/issues/1839
this.hasScrollControls =
['top', 'bottom'].includes(this.placement) && this.nav.scrollWidth > this.nav.clientWidth;
['top', 'bottom'].includes(this.placement) && this.nav.scrollWidth > this.nav.clientWidth + 1;
}
}