question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Buttons with tooltip raise deprecation warning in StrictMode

See original GitHub issue

Bug Description

Initially raised as part of the bug bash for dashboard sharing, this issue is not DS-specific and applies to all Button component use with tooltips.

To reproduce, open the browser console and then hover a button that has a tooltip (e.g. user menu, help menu, idea hub action button, etc). They all raise the same warning (with a different trace):

Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside StrictMode. Instead, add a ref directly to the element you want to reference. Learn more about using refs safely here: https://fb.me/react-strict-mode-find-node
Bug bash issue

Bug bash issue: https://app.asana.com/0/1202258919887896/1202436389160100 please refer to Asana issue for background

Not sure exactly how I triggered this but noticed it in the console. We don’t use this prop directly anywhere but the trace indicates UserRoleSelect.

Warning: Failed prop type: Material-UI: The `anchorEl` prop provided to the component is invalid.
The anchor element should be part of the document layout.
Make sure the element is present in the document or that it's not display none.
    in ForwardRef(Popper) (created by ForwardRef(Tooltip))
    in ForwardRef(Tooltip) (created by WithStyles(ForwardRef(Tooltip)))
    in WithStyles(ForwardRef(Tooltip)) (created by Button)
    in Button (created by UserRoleSelect)
    in div (created by UserRoleSelect)
    in UserRoleSelect (created by Module)
    in div (created by Module)
    in div (created by Module)
    in Module (created by DashboardSharingSettings)
    in div (created by DashboardSharingSettings)
    in div (created by DashboardSharingSettings)
    in DashboardSharingSettings (created by DashboardSharingSettingsButton)
    in div (created by DashboardSharingSettingsButton)
    in div
    in Unknown (created by DashboardSharingSettingsButton)
    in div (created by e)
    in div (created by e)
    in div (created by e)
    in e (created by DashboardSharingSettingsButton)
    in Portal (created by DashboardSharingSettingsButton)
    in DashboardSharingSettingsButton (created by DashboardMainApp)
    in div (created by Cell)
    in Cell (created by Header)
    in div (created by Row)
    in Row (created by Header)
    in div (created by ForwardRef)
    in ForwardRef (created by Header)
    in header (created by Header)
    in Header (created by DashboardMainApp)
    in DashboardMainApp (created by DashboardEntryPoint)
    in DashboardEntryPoint
    in RestoreSnapshots (created by Root)
    in ErrorHandler (created by Root)
    in Root

Steps to reproduce

Note: this warning will only appear in development builds because it is triggered by React’s Strict Mode

  1. Go to the Site Kit dashboard
  2. Hover a button that has a tooltip (e.g. user menu avatar button)
  3. See warning in console

Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • Buttons with tooltips should not raise deprecation warnings when interacting with them

Implementation Brief

  • Within assets/js/components/Root/index.js:
    • As per this comment, within say <ViewContextProvider>, add <ThemeProvider theme={createTheme}> where createTheme is unstable_createMuiStrictModeTheme() only when in dev mode, otherwise it is createTheme(). <ThemeProvider>, unstable_createMuiStrictModeTheme and createTheme should all be imported from '@material-ui/core'

Test Coverage

  • No new tests required.

QA Brief

  • In addition to verifying the ACs:
    • This issue makes a change to the <Root> component which is used by all pages of the plugin. Hence, smoke testing should be done on all pages, including the WP Admin Bar and WP Dashboard.

Changelog entry

  • Fix React StrictMode warning when using Material button tooltips in development mode.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
eclarke1commented, Jun 16, 2022

@wpdarren see comment above, could you please try to reproduce this one again?

0reactions
wpdarrencommented, Sep 16, 2022

QA Update: ✅

Verified:

  • Buttons with tooltips do not raise deprecation warnings when interacting with them.
  • I tested this on develop branch and also on the development build.
  • I went through all of the pages within Site Kit and did not discover any additional warnings or errors in the console.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I fix ''findDOMNode is deprecated in StrictMode' ...
I get '' findDOMNode is deprecated in StrictMode '' in my console when I click on the button that triggers drawer to open....
Read more >
CHANGELOG.en-US.md - ant-design/ant-design - Sourcegraph
Fix Tabs add button color invisible in dark mode. #39724; Fix the problem that the height of the title bar is not enough...
Read more >
Updates - React PDF Viewer
Fix more issues that only happen with React 18's Strict mode: The `initialPage` option doesn't work; The pages are flickering when zooming the...
Read more >
material-ui/core/CHANGELOG.md
194, - [Tooltip] Supress warning if button is disabled and title is empty (#13785) @ ... 509, - ⚛️ Fix some React 16.6.0...
Read more >
(Warning 56k) Alt text is not displayed as a tooltip over < ...
Summary: ALT tag behaviour → alt tags are not displayed as tooltips ... alt text (deprecated but available for a short while) for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found