concertina 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -34,7 +34,7 @@ function pinToScrollTop(el) {
34
34
  let parent = el.parentElement;
35
35
  while (parent) {
36
36
  const { overflowY } = getComputedStyle(parent);
37
- if (overflowY === "auto" || overflowY === "scroll") {
37
+ if ((overflowY === "auto" || overflowY === "scroll") && parent.scrollHeight > parent.clientHeight) {
38
38
  const box = parent.getBoundingClientRect();
39
39
  const target = el.getBoundingClientRect();
40
40
  let stickyOffset = 0;
package/dist/index.d.cts CHANGED
@@ -32,6 +32,11 @@ declare function useConcertina(): UseConcertinaReturn;
32
32
  * clearing any sticky headers. Only adjusts one container's
33
33
  * scrollTop. Never cascades to the viewport, which matters on
34
34
  * mobile where scrollIntoView pulls the whole page.
35
+ *
36
+ * Skips elements that have overflow: auto/scroll in CSS but
37
+ * don't actually scroll (scrollHeight <= clientHeight). Without
38
+ * this check, a non-scrolling ancestor with overflow-auto traps
39
+ * the walk and the real scroll container never gets adjusted.
35
40
  */
36
41
  declare function pinToScrollTop(el: HTMLElement | null): void;
37
42
 
package/dist/index.d.ts CHANGED
@@ -32,6 +32,11 @@ declare function useConcertina(): UseConcertinaReturn;
32
32
  * clearing any sticky headers. Only adjusts one container's
33
33
  * scrollTop. Never cascades to the viewport, which matters on
34
34
  * mobile where scrollIntoView pulls the whole page.
35
+ *
36
+ * Skips elements that have overflow: auto/scroll in CSS but
37
+ * don't actually scroll (scrollHeight <= clientHeight). Without
38
+ * this check, a non-scrolling ancestor with overflow-auto traps
39
+ * the walk and the real scroll container never gets adjusted.
35
40
  */
36
41
  declare function pinToScrollTop(el: HTMLElement | null): void;
37
42
 
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ function pinToScrollTop(el) {
13
13
  let parent = el.parentElement;
14
14
  while (parent) {
15
15
  const { overflowY } = getComputedStyle(parent);
16
- if (overflowY === "auto" || overflowY === "scroll") {
16
+ if ((overflowY === "auto" || overflowY === "scroll") && parent.scrollHeight > parent.clientHeight) {
17
17
  const box = parent.getBoundingClientRect();
18
18
  const target = el.getBoundingClientRect();
19
19
  let stickyOffset = 0;
package/dist/styles.css CHANGED
@@ -40,15 +40,15 @@
40
40
  }
41
41
  }
42
42
 
43
- /* When switching between items, suppress all animations so the layout
44
- is immediately in its final state for scroll pinning.
43
+ /* When switching between items, run animations instantly so layout
44
+ is in its final state for scroll pinning. Uses duration: 0s rather
45
+ than animation: none to avoid re-triggering the close animation
46
+ when data-switching is cleared after paint.
45
47
  data-switching is set by useConcertina(), cleared after paint. */
46
48
  [data-switching] .concertina-content[data-state="closed"] {
47
- animation: none;
48
- height: 0;
49
- opacity: 0;
49
+ animation-duration: 0s;
50
50
  }
51
51
 
52
52
  [data-switching] .concertina-content[data-state="open"] {
53
- animation: none;
53
+ animation-duration: 0s;
54
54
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "concertina",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "React hook for scroll-pinned Radix Accordion panels. Zero dependencies.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",