base-ui icon indicating copy to clipboard operation
base-ui copied to clipboard

[TextareaAutosize] Fix resizing instability

Open ZeeshanTamboli opened this issue 1 year ago • 12 comments

Fixes #168 Fixes #160

Thanks to @hyorimitsu for pinpointing the cause of the issue, as mentioned in https://github.com/mui/base-ui/issues/168#issuecomment-2001938569.

The solution involves storing the height in a ref and updating it only when it differs from the previous value. Previously, we set the height everytime even if it remained unchanged, causing the glitch.

Before: https://codesandbox.io/p/sandbox/old-wave-py2jkq After: https://codesandbox.io/p/sandbox/admiring-dan-9kqmtk


If this looks good, should I open a PR in the Material UI repository as well? This fix addresses a regression, and I'm uncertain about when it will be released from this repository.

ZeeshanTamboli avatar Mar 16 '24 10:03 ZeeshanTamboli

I'm having trouble coming up with a test for this. @oliviertassinari, since you added the "PR: needs test" label, could you assist me with it?

ZeeshanTamboli avatar Mar 19 '24 06:03 ZeeshanTamboli

If this looks good, should I open a PR in the Material UI repository as well? This fix addresses a regression, and I'm uncertain about when it will be released from this repository.

We are not going to release any new versions from this repo anytime soon (not unless we have a consistent API across existing components).

We decided not to encourage contributions to the Base UI in the Core repo either (so we don't end up managing two diverging versions), but since you already took the effort to fix the bug, we can release it from the Core repo.

I understand that it's not a perfect situation and we're doing what we can to have just one copy of the source code as soon as possible.

michaldudak avatar Mar 20 '24 21:03 michaldudak

Since there is no one copy of the source code yet, I think we should fix it here in this repository too, or it will become out of sync. Once it's good here, I'll make a PR in the Core repository too. I think we should point it to the master branch instead of next in the Core repository and release it under v5. Later, we can merge the master branch with this fix into next. What are your thoughts on this? Who will release from the master branch and when?

ZeeshanTamboli avatar Mar 21 '24 05:03 ZeeshanTamboli

@DiegoAndai, @mnajdova - what would be the best way to release this from the Core repo?

michaldudak avatar Mar 21 '24 06:03 michaldudak

looking forward to seeing this fixed

pirtlj avatar Mar 21 '24 17:03 pirtlj

Auto-sizing can be handled with field-sizing. It's not currently well-supported, though it should be later this year. So we're planning to deprecate this component for our v1 release later this year.

Here's a demo.

colmtuite avatar Mar 21 '24 22:03 colmtuite

what would be the best way to release this from the Core repo?

As discussed today in the core team meeting:

We can release whenever we have something to release. The process is to merge the change to next and then cherry-pick to master. Releases from master will only happen if there are changes.

DiegoAndai avatar Mar 22 '24 15:03 DiegoAndai

Created PR in Core repo: https://github.com/mui/material-ui/pull/41638.

ZeeshanTamboli avatar Mar 25 '24 12:03 ZeeshanTamboli

@mui/base-ui I believe we should consider merging this. See the rationale in https://github.com/mui/base-ui/issues/168#issuecomment-2067972934. The corresponding PR in the core repository (https://github.com/mui/material-ui/pull/41638) has been merged, for existing @mui/base users and @mui/material users and those utilizing Material UI TextField with the multiline prop.

Regarding the test, I've implemented an E2E test in the Core repository. However, we currently lack the setup for E2E tests here. Should I proceed with setting up an E2E test suite, or should we consider merging this PR without a test?

ZeeshanTamboli avatar Apr 26 '24 14:04 ZeeshanTamboli

All right, we can merge it here as the future of this component is not clear yet. As for E2E tests, could you set them up in a separate PR?

michaldudak avatar May 02 '24 06:05 michaldudak

As for E2E tests, could you set them up in a separate PR?

I just saw it's being done in #395.

ZeeshanTamboli avatar May 05 '24 10:05 ZeeshanTamboli

All right, let's add the test once #395 is merged and we'll be able to close it.

michaldudak avatar May 07 '24 07:05 michaldudak

@michaldudak Added test. Ready for merge.

ZeeshanTamboli avatar May 08 '24 07:05 ZeeshanTamboli