Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltip: positioned incorrectly in React 18 #3065

Closed
robriii opened this issue Jul 15, 2022 · 5 comments
Closed

Tooltip: positioned incorrectly in React 18 #3065

robriii opened this issue Jul 15, 2022 · 5 comments
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@robriii
Copy link

robriii commented Jul 15, 2022

Describe the bug

Tooltips are displayed at the bottom of the page, without any content when the application is rendered using the new React 18 root API.
tooltip

Reproducer

https://codesandbox.io/s/little-voice-s8ued1?file=/src/demo/TooltipDemo.tsx:7828-7838

PrimeReact version

8.2.0

React version

18.x

Language

TypeScript

Build / Runtime

Create React App (CRA)

Browser(s)

No response

Steps to reproduce the behavior

  1. Move the mouse hover buttons
  2. The tooltip appears at the bottom of the page with no content

Expected behavior

Tooltip should appear where it is supposed to.

@robriii robriii added Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible Type: Bug Issue contains a defect related to a specific component. labels Jul 15, 2022
@melloware melloware changed the title Component: Tooltip Tooltip: position incorrectly Jul 15, 2022
@melloware
Copy link
Member

No you are right with React 17 it is working: https://codesandbox.io/s/primereact-test-forked-h2fpcx?file=/src/index.js

@melloware melloware added 👍 confirmed and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jul 15, 2022
@melloware melloware changed the title Tooltip: position incorrectly Tooltip: positioned incorrectly in React 18 Jul 15, 2022
@melloware melloware added React 18 Issue or pull request is *only* related to React 18 and removed Type: Bug Issue contains a defect related to a specific component. labels Jul 15, 2022
@melloware melloware added this to the 9.0.0 milestone Jul 15, 2022
@melloware
Copy link
Member

OK it is because of these lines creating the Tooltip component.

    if (visibleState) {
        const element = createElement();

        return <Portal element={element} appendTo={props.appendTo} visible />;
    }

    return null;

In React 18 that is somehow not properly creating the Portal and element even when the visibleState changes to true.

@mertsincan mertsincan added Type: Bug Issue contains a defect related to a specific component. and removed 👍 confirmed React 18 Issue or pull request is *only* related to React 18 labels Jul 15, 2022
@agnyp
Copy link

agnyp commented Jul 17, 2022

Amazing how quickly that was fixed, yet, is there a workaround until 9.0.0 comes out?

@melloware
Copy link
Member

melloware commented Jul 17, 2022

I think an 8.3.0 will be coming out shortly with this fix.

@mertsincan mertsincan modified the milestones: 9.0.0, 8.3.0 Jul 18, 2022
@agnyp
Copy link

agnyp commented Jul 18, 2022

Great job guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

4 participants