Skip to content

fix: update useIsStuck to useEffect for prerendering, improve sticky tabs - #5119

Merged
wise-king-sullyman merged 2 commits into
patternfly:mainfrom
mcoker:issue-5118
Oct 22, 2026
Merged

wise-king-sullyman merged 2 commits into
patternfly:mainfrom
mcoker:issue-5118

Conversation

@mcoker

@mcoker mcoker commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

fixes #5118

Updates useIsStuck.js to use useLayoutEffect when there is a browser window and useEffect when there isn't (for the prerendering step of the build), which suppresses all of the warnings the build was throwing.

Also took a stab at improving the dynamic sticky tabs behavior. The existing behavior is often flaky. It doesn't always make the tabs sticky when scrolling fast, landing on/going to page anchors, and other random times.

From the robots, this PR updates useIsStuck.js to:

  • Use comparable coordinates - Previously, the hook compared scrollElement.scrollTop with stickyElement.offsetTop. scrollTop is relative to the scrolling container, while offsetTop is relative to the element’s offset parent; those aren’t necessarily the same coordinate system. The hook now compares the tabs’ rendered top with the scrollport’s rendered top, so it checks whether the tabs are actually stuck at the container’s edge.
  • Clear stale state when elements are missing - If either DOM element can’t be found, the hook now resets both its ref and React state to false. This avoids leaving the stuck background enabled based on an earlier measurement.
  • The ref is also updated before scheduling the React state change, keeping its transition check aligned with the latest measurement.
  • Adds a window resize event listener to handle sticky behavior when the window resizes, which is most relevant on pages with a lot of content (that wraps differently on resize) above the tabs.

@patternfly-build

Copy link
Copy Markdown
Collaborator

Preview: https://pf-org--pr-5119-site.surge.sh

@wise-king-sullyman
wise-king-sullyman merged commit bcfef08 into patternfly:main Oct 22, 2026
6 checks passed
@patternfly-build

Copy link
Copy Markdown
Collaborator

Your changes have been released in:

  • @patternfly/ast-helpers@1.4.0-alpha.430
  • @patternfly/documentation-framework@6.54.3

Thanks for your contribution! 🎉

wise-king-sullyman added a commit that referenced this pull request Nov 10, 2026
* feat(ver): update to 6.7 prereleases (#5113)

* feat(ver): bump to 6.7 prerelease

* update screenshots

* chore(release): releasing packages [ci skip]

 - @patternfly/ast-helpers@1.4.0-alpha.421
 - @patternfly/documentation-framework@6.53.0

* Chatbot bump (#5114)

* fix(deps): Update ChatBot

* Add screenshots

* Fix lock file

* Fix latest vs hidden

* chore(release): releasing packages [ci skip]

 - @patternfly/ast-helpers@1.4.0-alpha.422
 - @patternfly/documentation-framework@6.53.1

* fix(docs): Update featured blog posts (#5115)

* chore(release): releasing packages [ci skip]

 - @patternfly/ast-helpers@1.4.0-alpha.423
 - @patternfly/documentation-framework@6.53.2

* fix(deps): Update ChatBot version (#5116)

Fixed a couple of regressions.

* chore(release): releasing packages [ci skip]

 - @patternfly/ast-helpers@1.4.0-alpha.424
 - @patternfly/documentation-framework@6.53.3

* docs (release-highlights): Adds 6.7 highlights (#5111)

* docs(release-highlights): add 6.7 highlights

Assisted-by: OpenAI Codex

* Apply suggestion from @phcox

* Apply suggestion from @rebeccaalpert

Co-authored-by: Rebecca Alpert <ralpert@redhat.com>

* Apply suggestion from @rebeccaalpert

Co-authored-by: Rebecca Alpert <ralpert@redhat.com>

* Apply suggestion from @phcox

* Apply suggestion from @phcox

* Apply suggestion from @phcox

* Revise release highlights for component updates

Added codeblock formatting to some content in the Chatbot section

* docs (release-highlights): Remove 6.7 prerelease suffixes

Assisted-by: OpenAI Codex

* docs (release-highlights): Date 6.7 release October 2026

Assisted-by: OpenAI Codex

---------

Co-authored-by: Patrick Cox <26148021+phcox@users.noreply.github.com>
Co-authored-by: Rebecca Alpert <ralpert@redhat.com>

* chore(release): releasing packages [ci skip]

 - @patternfly/ast-helpers@1.4.0-alpha.425
 - @patternfly/documentation-framework@6.53.4

* chore(release): added modal test verbiage (#5117)

* chore(release): releasing packages [ci skip]

 - @patternfly/ast-helpers@1.4.0-alpha.426
 - @patternfly/documentation-framework@6.53.5

* feat(ver): update to 6.7 release (#5120)

* feat(ver): update to 6.7 release

* updated screenshots

* chore(release): releasing packages [ci skip]

 - @patternfly/ast-helpers@1.4.0-alpha.427
 - @patternfly/documentation-framework@6.54.0

* fix(docs): Update featured posts (#5121)

* chore(release): releasing packages [ci skip]

 - @patternfly/ast-helpers@1.4.0-alpha.428
 - @patternfly/documentation-framework@6.54.1

* deps(react-core): update react-core version to fix broken page demos (#5122)

* deps(react-core): update react-core version to fix broken page demos

* Update yarn lock

* docs(Page): Update broken demo screenshots

* chore(release): releasing packages [ci skip]

 - @patternfly/ast-helpers@1.4.0-alpha.429
 - @patternfly/documentation-framework@6.54.2

* fix: update useIsStuck to useEffect for prerendering, improve sticky tabs (#5119)

* fix: update useIsStuck to useEffect for prerendering

* chore: fix sticky tabs scroll bugs

* chore(release): releasing packages [ci skip]

 - @patternfly/ast-helpers@1.4.0-alpha.430
 - @patternfly/documentation-framework@6.54.3

* chore(deps): Update patternfly-doc-core with API fixes (#5123)

* chore(deps): Update patternfly-doc-core with API fixes

* Update doc-core to 1.24.2

* chore(release): releasing packages [ci skip]

 - @patternfly/ast-helpers@1.4.0-alpha.431
 - @patternfly/documentation-framework@6.54.4

* chore(deps): update doc-core to 1.24.3 (#5124)

* chore(release): releasing packages [ci skip]

 - @patternfly/ast-helpers@1.4.0-alpha.432
 - @patternfly/documentation-framework@6.54.5

---------

Co-authored-by: kmcfaul <45077788+kmcfaul@users.noreply.github.com>
Co-authored-by: patternfly-build <patternfly-build@redhat.com>
Co-authored-by: Rebecca Alpert <ralpert@redhat.com>
Co-authored-by: Patrick Cox <pcox@redhat.com>
Co-authored-by: Patrick Cox <26148021+phcox@users.noreply.github.com>
Co-authored-by: Eric Olkowski <70952936+thatblindgeye@users.noreply.github.com>
Co-authored-by: Michael Coker <35148959+mcoker@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug - docs framework - lots of prerender warnings during build

4 participants