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 Both Fix with Dynamic State #7288

Merged
merged 3 commits into from
Oct 1, 2024

Conversation

ddoemonn
Copy link
Contributor

@ddoemonn ddoemonn commented Oct 1, 2024

fixes #7260

before

Screen.Recording.2024-10-01.at.20.27.31.mov

after

Screen.Recording.2024-10-01.at.20.28.20.mov

Copy link

vercel bot commented Oct 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
primereact ⬜️ Ignored (Inspect) Visit Preview Oct 1, 2024 5:43pm
primereact-v9 ⬜️ Ignored (Inspect) Visit Preview Oct 1, 2024 5:43pm

components/lib/tooltip/Tooltip.js Outdated Show resolved Hide resolved
@melloware melloware added this to the 10.8.4 milestone Oct 1, 2024
@@ -14,6 +14,7 @@ export const Tooltip = React.memo(
const [visibleState, setVisibleState] = React.useState(false);
const [positionState, setPositionState] = React.useState(props.position || 'right');
const [classNameState, setClassNameState] = React.useState('');
const [multipleFocusEvents, setMultipleFocusEvents] = React.useState(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually you can switch this to a ref it doesn't need to be useState as its not used in any hooks you are just tracking a boolean state.

Copy link
Contributor Author

@ddoemonn ddoemonn Oct 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can update it but there is something I didn't understand help me if I'm missing something. I put boolean inside of state because I wanted trigger a boolean value with using ref how can I achieve that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you jiust do yourRef.current = true or false

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeap, I did the same but like I said we should trigger the component. You can try it in your local or I can commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interesting i was not expecting that based on looking at this code. You are just using a boolean flag. Changing the state is not used by any hook?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@melloware you merged but there is prettier error what should I do?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I can fix it. Next time run npm run format on the codebase it fixes it

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When will be the release date?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Luko248 that is up to PrimeTek I don't have any insight on release dates.

@melloware melloware merged commit 9d76a74 into primefaces:master Oct 1, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tooltip event="both" does not work if element get focus state by clicking on it
3 participants