- Issue created by @RobbyMo
- ๐ฎ๐ณIndia Vivek Panicker Kolkata
Vivek Panicker โ made their first commit to this issueโs fork.
- Merge request !4Issue #3441110: Replaced textfield with text area in chat form. โ (Merged) created by Vivek Panicker
- ๐ฎ๐ณIndia Vivek Panicker Kolkata
Inspiration taken from Autogrow textarea module.
- Status changed to Needs review
4 months ago 6:51am 28 April 2024 - ๐ฎ๐ณIndia Vivek Panicker Kolkata
Vivek Panicker โ changed the visibility of the branch aws_bedrock_chat-3443827 to hidden.
- ๐บ๐ธUnited States RobbyMo
Thank you for providing an update for this Vivek! One thing that I ask that you add into your MR is the changes for the other references to the old input textfield.
For example in aws_bedrock_chat.js:
var userMessage = $('input.aws-bedrock-chat-user-input', context).val();
In aws_bedrock_chat.css:
.aws-bedrock-chat-input .form-type-textfield
and
.aws-bedrock-chat-input input.aws-bedrock-chat-user-input:focus
In the ChatForm.php file when you change the 'user_input' #type to 'textarea' it now is resizable by the user. I would suggest adding the following to the 'user_input' form array to stop Drupal's default resizing capability on the the textarea:
'#resizable' => 'none',
Another thing that I noticed is that the textarea automatically expanded before it was necessary, I think it might be from function updateTextareaHeight() where you have textarea.style.height = ""; to reset the height. I think you might need to put in the explicit height there. Since you put 50px in the css, putting 50px here should reset it to the original height before determining if it needs to expand. This same reset will be needed after line 50 $('.aws-bedrock-chat-user-input', context).val(''); where the input is cleared after submission so that the textarea field returns to the default size after the message is sent.
The other changes look good, just let me know if you have any questions, thanks!
- ๐ฎ๐ณIndia Vivek Panicker Kolkata
Regarding setting
resizable=>'none'
, there seems to be an existing CORE issue: https://www.drupal.org/project/drupal/issues/2787025 ๐ Setting #resizable on a textarea has no effect Needs review .The issue was closed, but I re-opened it since it still exists.
So adding the attribute from the backend is not having any effect, so I marked it resizble: false in the CSS.
I have addressed the feedbacks you have mentioned and updated the MR.
-
RobbyMo โ
committed 11fb32f3 on 1.0.x authored by
Vivek Panicker โ
Issue #3441110: Replaced textfield with text area in chat form.
-
RobbyMo โ
committed 11fb32f3 on 1.0.x authored by
Vivek Panicker โ
- Status changed to RTBC
4 months ago 11:06pm 7 May 2024 - Status changed to Fixed
4 months ago 11:08pm 7 May 2024 Automatically closed - issue fixed for 2 weeks with no activity.