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

PrimeReactProvider: cssTransition false does not disable animations globally #7395

Closed
elburro1887 opened this issue Nov 5, 2024 · 2 comments · Fixed by #7417
Closed

PrimeReactProvider: cssTransition false does not disable animations globally #7395

elburro1887 opened this issue Nov 5, 2024 · 2 comments · Fixed by #7417
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@elburro1887
Copy link

elburro1887 commented Nov 5, 2024

Describe the bug

When setting cssTransition to false in PrimeReactProvider, animations are not disabled globally:

<PrimeReactProvider value={{ cssTransition: false }}>
    <App />
</PrimeReactProvider>

Setting transitionOptions={{ disabled: true }} on the Component itself works though.

Reproducer

https://stackblitz.com/edit/cc98j5-u72fsi?file=src%2FApp.jsx

System Information

...

Steps to reproduce the behavior

<PrimeReactProvider value={{ cssTransition: false }}>

Expected behavior

Disabled animations on a global level

@elburro1887 elburro1887 added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Nov 5, 2024
@melloware melloware added Type: Bug Issue contains a defect related to a specific component. and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Nov 6, 2024
@melloware melloware added this to the 10.8.5 milestone Nov 14, 2024
@tneeraja95
Copy link
Contributor

Had a look at the code and found the bug -
Problem is in file PrimeReactContext.js, line 15

const [cssTransition, setCssTransition] = useState(propsValue.cssTransition || true);

|| is OR, which basically means that even when cssTransition from props is false, false || true return true.

Instead of OR what we really want is 'Nullish coalescing operator (??)', which returns its right-hand side operand when its left-hand side operand is null or undefined, and otherwise returns its left-hand side.

I think, we should replace || with ?? for other props as well.

Have created this PR in my local fork - #7417

Please have a look and give me permission to make this change.

@melloware
Copy link
Member

Yes please make the changes to the other props as well.

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

Successfully merging a pull request may close this issue.

3 participants