Repository navigation
Conversation
…/actions change
Tab re-measures the current-tab accent whenever the title/actions prop
identity changes, and passed `true` to setAccentStyles, which applies
pf-m-initializing-accent (accent transition duration 0). React element
props get a new identity on every parent render, so with the documented
inline usage (title={<TabTitleText>...</TabTitleText>}) this effect fires
on every render, including every tab switch.
On React 18 the effect flushed after the componentDidUpdate accent update
had already committed, so the transition ran and the later re-measure was a
visual no-op. React 19 flushes pending passive effects before rendering the
nested update from componentDidUpdate, so isInitializingAccent lands in the
same commit as the new accent position values and the underline jumps
instead of animating (fixes patternfly#12725).
Re-measure without the initializing flag instead. Spurious re-runs become
harmless: they queue the same accent values componentDidUpdate already
queued, so nothing visually changes. The initial-mount measurement keeps
using the flag via componentDidMount, so the underline still appears in
place on first render. As a side effect, a genuine title/actions change now
animates the accent to its new position, consistent with the
pf-m-animate-current design.
Assisted-by: Opencode glm-5-3
|
No actionable comments were generated in the recent review. WalkthroughThe Tab effect now calls ChangesTabs accent behavior
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk:
|
|
Preview: https://pf-react-pr-12726.surge.sh A11y report: https://pf-react-pr-12726-a11y.surge.sh |
What: Closes #12725
Additional issues: n/a
Root cause
Tabre-measures the current-tab accent whenever thetitle/actionsprop identity changes, and passedtruetosetAccentStyles, which appliespf-m-initializing-accent(--pf-v6-c-tabs--link-accent--TransitionDuration: 0):React element props get a new identity on every parent render, so with the documented inline usage (
title={<TabTitleText>…</TabTitleText>}) this effect fires on every render, including every tab switch.componentDidUpdateaccent update had already committed, so the transition ran and the later re-measure computed identical values — a visual no-op.componentDidUpdate, soisInitializingAccent: truelands in the same commit as the new accent position values. The only style recalc sees the new position with transition duration 0, so the underline jumps instead of animating.Change
The title/actions re-measure no longer applies the initializing flag:
componentDidUpdatealready queued, so nothing visually changes.componentDidMount, so the underline still appears in place on first render (existing mount tests are unchanged).title/actionscontent change now animates the accent to its new position, consistent with thepf-m-animate-currentdesign, instead of jumping.Verification
Does not render with class pf-m-initializing-accent when a controlled tab is selectedfails onmainand passes with this change. It renders controlled tabs with inline title elements, selects a tab, and asserts viaMutationObserverthatpf-m-initializing-accentnever transiently appears.translate0 → 52.5 → 81.2 → 91px at 40/80/160ms after click) instead of jumping, matching the memoized-titles workaround demo, andpf-m-initializing-accentno longer appears during selection.Summary by CodeRabbit