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

If the height is changed from the outside while the open/close process has never been executed, it will not synchronize. #100

Closed
makotot opened this issue Sep 15, 2022 · 5 comments · Fixed by #122 or #125

Comments

@makotot
Copy link

makotot commented Sep 15, 2022

If it is initially open and a change occurs that changes the internal height, react-collapsed will not reflect the change.
After the second time, the height is correctly recognized as normal.

Reproducing URL:
https://stackblitz.com/edit/react-ts-23bci9?file=App.tsx

Pressing the "+1" button does not change the height of the item, so the item is not fully displayed.
If you press the "Toggle" button once, the height will always be updated, with all items displayed.

I'm assuming this behavior is probably a bug, not a specification. But I don't know much about it.
I am not sure if this is the scope of react-collapsed too.

defaultExpanded value has no effect.

@makotot
Copy link
Author

makotot commented Sep 21, 2022

This problem does not seem to occur in React v17 but from v18.
https://stackblitz.com/edit/react-ts-jncunm?file=index.tsx

The same problem does not occur in v18 unless StrictMode is used.

roginfarrer added a commit that referenced this issue Nov 27, 2022
## BREAKING CHANGES

- Adopts React 18's `useId`, making the library incompatible with React <18
- Switch to `tsup` from `microbundle` for bundling library. No longer exports a UMD version, just CJS and MJS

## Features & Bug fixes

- Refactors core functionality to vanilla JS (with a React) adapter, which I think should fix #103 and fix #100 
- Added `onExpandedChange` option
- Tries to detect if `getToggleProps` is used. If the toggle element ref can be accessed, the `aria-labelledby` attribute will be added to the collapse element
- Added `role="region"` to collapse
- Updated toggle props to pass the appropriate attributes to the element, whether it's a button or not
@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 3.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

roginfarrer pushed a commit that referenced this issue Nov 27, 2022
BREAKING CHANGES

- Adopts React 18's `useId`, making the library incompatible with React <18
- Switch to `tsup` from `microbundle` for bundling library. No longer exports a UMD version, just CJS and MJS

Features & Bug fixes

- Refactors core functionality to vanilla JS (with a React) adapter, which I think should fix #103 and fix #100
- Added `onExpandedChange` option
- Tries to detect if `getToggleProps` is used. If the toggle element ref can be accessed, the `aria-labelledby` attribute will be added to the collapse element
- Added `role="region"` to collapse
- Updated toggle props to pass the appropriate attributes to the element, whether it's a button or not
@github-actions
Copy link
Contributor

🎉 This issue has been resolved in version 3.8.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@roginfarrer
Copy link
Owner

Meant to release at v4@next, but couldn't figure out the magic words for semantic-release 🤷🏻. Can you try testing with react-collapsed@next @makotot?

@makotot
Copy link
Author

makotot commented Nov 28, 2022

@roginfarrer Thanks for getting back to me!
I've tried with v3.8.0 and can confirm the issue has been solved 👍
https://stackblitz.com/edit/react-ts-tunpnu?file=package.json

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants