Textarea autoSize after save or error
I'm trying to make my textarea autosize. Everything works fine upon rendering, but if I save the form or encounter an error, the textarea does not autosize and shrinks to 2 rows.
Basic form :
I see some other declared issue but not work.
16 Replies
Solution
There’s an open PR that will fix this when it’s merged.
I missed the PR, thanks for the info!
did this get merged. I am having this problem still and I'm on the latest release. When I use $set in the action of a HintAction on the orignal form inside a orignal moda. The textarea gets reset
ah I think not. fairly new to working on githib. I see it was merged yesterday but the latest filament release was last week.
hmmm @awcodes I see the update was just released. Testing my end doesnt seem to have fixed our issue. We have a hint action that will get an address and then $set is back into the textfield. If the address has more lines than the original textfield size it doesnt autosize. Was this the original issue?
make sure you run
artisan filament:upgrade
. zep verified that the fix works.I'll run it again
I have that on my script though
I'll see if I can capture a video of it
oh dear lord. I had removed the ->autofocus() before I tested the release
sorry about that
Hmm half fixed from what I can tell (first option doesnt work but second does). It seems if a modal form is involved in the hint action it didnt like it:
didnt work:
Worked:
Action modals work in the demo
you are welcome to open an issue if you can give us a minimum reproduction repo. 🙂
I could be wrong but I don't see in that clip the value from the hint action being passed back down to the Create Post form textfield?
I have a hint action that gets a supplier. The action() then gets the address of said supplier and $set it into the parent form
it works if no form() on the modal and you only run login in action()
trying to debug it
seems rather odd.
Not sure then sorry. I'd have to see it. if you think its a bug please submit an issue for it on GitHub with a reporoduction repo. 🙂
okay, so its 100% not my code.
doesnt work:
works:
what does this have to do with the textarea autosize?
Sorry here is the full code.
Textarea has a hintAction(). The hintaction is a modal form with a Select to get a Supplier. The action() on the hintaction $set the address back down to the Textarea
the textarea does not update its size
however, if I dont have a modal popup form on the hintaction and only apply some manual logic in the action() then it will work.
so it seems if a second modal is introduced that upon Submit it should $set the parent Textfield, it fails
ok. please submit an issue on GitHub. Can't do anything about it on here and I"m not seeing anything weird in your code.
Will do
ty
https://github.com/filamentphp/filament/issues/13879 like but really sorry I dont have the time to get a production repo in place right now. It should be very easy to replicate from the preivous PRs repo ?
GitHub
Autosize not adjusting after its value is $set from a hintAction · ...
Package filament/filament Package Version v3.2.98 Laravel Version v11.19 Livewire Version v3 PHP Version PHP 8.3 Problem description Autosize is not adjusting its size after a hintAction WITH a for...
added a comment to PR: https://github.com/filamentphp/filament/pull/13748#issuecomment-2278052939
maybe that better explains 🙂
GitHub
Persist Textarea autosize by awcodes · Pull Request #13748 · filame...
Description
Resolves #13722. Prevents textarea autosize from being reset during livewire requests.
Visual changes
Screen.Recording.2024-07-30.at.1.07.45.PM.mov
...
Screen.Recording.2024-07-30.at.1.07.45.PM.mov
...