Skip to content

Multiline strings displaying with carriage in textarea elements #2088

Description

@dzenreda

Hello,

I found that in HTML textarea elements, when writing multiline text, show texts with a horizontal whitespace for every line after the first one.
This is happening only when loading text, not at the time of writing it. I realised that it is only happening if the textarea is inside a partial template and the displayed text is passed as an attribute.

In my case, I have a form with a field description that is a multiline text.

form.handlebars

{{> components/center-info name=center.name description=center.description }}

components/center-info.handlebars

<section class="form-group mb-4">
    <label for="center-name" class="block text-gray-700 font-medium">Nombre de la Centro</label>
    <input id="center-name" name="name" type="text" value="{{name}}" required autofocus
        class="mt-1 block w-full p-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500" />
</section>

<section class="form-group mb-4">
    <label for="center-description" class="block text-gray-700 font-medium mb-1">Descripción</label>
    <textarea id="center-description" name="description" rows="4" required
        class="w-full px-3 py-2 border border-gray-300 rounded-lg shadow-sm focus:ring-2 focus:ring-blue-500 focus:outline-none">{{description}}</textarea>
</section>

For instance, for a string like this

aaaaa\r\n\r\na

The representation in the textarea inside the components/center-info.handlebars is this

Image

However, if I place the textarea outside the component, i.e. in the form.handlebars template, it display the string correctly

Image

I think this might be related with the parsing of the attribute 🤔

Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions