Skip to content

Conversation

@ronnakamoto
Copy link

@ronnakamoto ronnakamoto commented Oct 26, 2025

Summary

This fixes #34738

In React 19.2, metadata tags (<title>) are automatically hoisted to the document . However, these tags were incorrectly being hoisted even when inside hidden components, causing the browser's document title to be set by hidden content.

image

This commit fixes the issue by making the hoisting logic Activity-aware:

  1. Check offscreenSubtreeIsHidden before mounting hoistables during the initial commit phase to prevent hoisting in hidden Activities
  2. Add recursivelyMountHoistablesInSubtree() to mount hoistables when an Activity transitions from hidden to visible
  3. Add recursivelyUnmountHoistablesInSubtree() to unmount hoistables when an Activity transitions from visible to hidden

How did you test this change?

Added tests for this as well as tested this on local using the reference code from the link https://github.com/nilshartmann/react-activity-title given in #34738 issue description.

@meta-cla meta-cla bot added the CLA Signed label Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: <title> in <Activity> sets the title when "mode=hidden"

1 participant