@patternfly/documentation-framework 6.54.2 → 6.54.3
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/CHANGELOG.md +11 -0
- package/hooks/useIsStuck.js +21 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 6.54.3 (2026-10-22)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* update useIsStuck to useEffect for prerendering, improve sticky tabs ([#5119](https://github.com/patternfly/patternfly-org/issues/5119)) ([bcfef08](https://github.com/patternfly/patternfly-org/commit/bcfef08817e6fad574a1498ce9ad4e9e5e51baa4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## 6.54.2 (2026-10-22)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @patternfly/documentation-framework
|
package/hooks/useIsStuck.js
CHANGED
|
@@ -1,33 +1,44 @@
|
|
|
1
|
-
import { useState, useLayoutEffect, useRef } from 'react';
|
|
1
|
+
import { useState, useEffect, useLayoutEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
// The prerenderer provides a partial document shim but no createElement.
|
|
4
|
+
const useIsomorphicLayoutEffect =
|
|
5
|
+
typeof document !== 'undefined' && typeof document.createElement === 'function'
|
|
6
|
+
? useLayoutEffect
|
|
7
|
+
: useEffect;
|
|
2
8
|
|
|
3
9
|
export const useIsStuck = (stickyElementId) => {
|
|
4
10
|
const [isStuck, setIsStuck] = useState(false);
|
|
5
11
|
const prevIsStuck = useRef(false);
|
|
6
12
|
|
|
7
|
-
|
|
13
|
+
useIsomorphicLayoutEffect(() => {
|
|
8
14
|
const scrollElement = document.getElementById('ws-page-main');
|
|
9
15
|
const stickyElement = document.getElementById(stickyElementId);
|
|
10
16
|
|
|
11
17
|
if (!scrollElement || !stickyElement) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
prevIsStuck.current = false;
|
|
15
|
-
}
|
|
18
|
+
prevIsStuck.current = false;
|
|
19
|
+
setIsStuck(false);
|
|
16
20
|
return;
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
const syncFromScroll = () => {
|
|
20
|
-
|
|
21
|
-
//
|
|
24
|
+
// Compare rendered positions: offsetTop may be relative to a different
|
|
25
|
+
// ancestor than the scrolling page container.
|
|
26
|
+
const scrollportTop = scrollElement.getBoundingClientRect().top + scrollElement.clientTop;
|
|
27
|
+
const stickyTop = stickyElement.getBoundingClientRect().top;
|
|
28
|
+
const newIsStuck = stickyTop <= scrollportTop + 1;
|
|
22
29
|
if (prevIsStuck.current !== newIsStuck) {
|
|
23
|
-
setIsStuck(newIsStuck);
|
|
24
30
|
prevIsStuck.current = newIsStuck;
|
|
31
|
+
setIsStuck(newIsStuck);
|
|
25
32
|
}
|
|
26
33
|
};
|
|
27
34
|
|
|
28
35
|
syncFromScroll();
|
|
29
36
|
scrollElement.addEventListener('scroll', syncFromScroll, { passive: true });
|
|
30
|
-
|
|
37
|
+
window.addEventListener('resize', syncFromScroll);
|
|
38
|
+
return () => {
|
|
39
|
+
scrollElement.removeEventListener('scroll', syncFromScroll);
|
|
40
|
+
window.removeEventListener('resize', syncFromScroll);
|
|
41
|
+
};
|
|
31
42
|
}, [stickyElementId]);
|
|
32
43
|
|
|
33
44
|
return isStuck;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patternfly/documentation-framework",
|
|
3
3
|
"description": "A framework to build documentation for PatternFly.",
|
|
4
|
-
"version": "6.54.
|
|
4
|
+
"version": "6.54.3",
|
|
5
5
|
"author": "Red Hat",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"http-cache-semantics": ">=4.1.1",
|
|
93
93
|
"nanoid": "3.3.8"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "d70cfbb0ceb909b7606254303b562518627cd027"
|
|
96
96
|
}
|