Repository navigation
Description
Library
React Components / v9 (@fluentui/react-components)
System Info
N/AAre you reporting Accessibility issue?
None
Reproduction
N/A
Bug Description
Actual Behavior
Accessing element.ref is deprecated: https://react.dev/blog/2024/04/25/react-19-upgrade-guide#deprecated-element-ref
We have various places where we work with elements directly and access refs:
fluentui/packages/react-components/react-toast/src/components/ToastTrigger/useToastTrigger.ts
Line 33 in fc5f6f5
| ref: child?.ref, |
fluentui/packages/react-components/react-tooltip/src/components/Tooltip/useTooltip.tsx
Line 263 in fc5f6f5
| child?.ref, |
fluentui/packages/react-components/react-dialog/src/components/DialogTrigger/useDialogTrigger.ts
Line 39 in fc5f6f5
| ref: child?.ref, |
We should check all locations and:
- modify
getTriggerChildto return a ref i.e.const [child, childRef] = getTriggerChild() - or add a separate helper
A compat helper will decide what accessor to use, a naive example:
function getElementRef(element: any) {
return (React as any)
// React 19 has new internals
.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE
? element.props.ref
: element.ref;
}
Logs
No response
Requested priority
High
Products/sites affected
No response
Are you willing to submit a PR to fix?
no
Validations
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- The provided reproduction is a minimal reproducible example of the bug.
Activity
microsoft-github-policy-service commentedon Feb 10, 2025
This issue has not had activity for over 180 days! We're adding Soft close label and will close it soon for house-keeping purposes.
Still require assistance? Please add comment - "keep open".
Foorack commentedon Feb 10, 2025
keep open
ahqsoftwares commentedon Feb 10, 2025
Any status on this issue?