View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0025839 | mantisbt | html | public | 2019-06-04 13:17 | 2019-11-13 12:19 |
Reporter | TomekAP | Assigned To | dregad | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 2.21.0 | ||||
Target Version | 2.22.0 | Fixed in Version | 2.22.0 | ||
Summary | 0025839: Leading newlines disappear when editing data in textarea elements | ||||
Description | if you write in e.g. steps_to_reproduce: Example: 3 5</textarea> | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Not sure I understand what you mean. We trim whitespace prior to saving, so any leading newlines would be removed, this is normal and expected behavior. |
|
I have tested it on 2.21 5 5 5 so the first new line is missing. |
|
OK, I see what you mean now. Looks like Mantis is somehow removing a single newline from the text, each time the issue is updated. What confused me was
But in fact in view issue page (view.php) you there are no leading newlines at all (as shown in attached screensot). |
|
So on our mantis new line at the beginning is not removed and is stored with new lines in DB. |
|
The newlines are stored in the DB exactly as you typed them when you click the Submit / Update button. They are only hidden on display (due to the fact that HTML ignores whitespace). The behavior you're experiencing is a consequence of the HTML5 specification (look under A start tag whose tag name is "textarea" , emphasis mine):
To fix this, we'd have to update the markup everywhere we use textareas, to add a newline after the opening tag. |
|
Please see PR https://github.com/mantisbt/mantisbt/pull/1518 Kindly test and let me know your feedback, either here or in the PR. |
|
As for me, it is OK, but wouldn`t be better to change it in the string_textarea function? |
|
Thanks for the feedback.
string_textarea() deals with display, so I don't think modifying it would be the right way to fix this issue. The problem as I see it, is about storage : MantisBT should not alter data (i.e. text should be stored exactly as the user entered it). Currently due to the behavior defined by HTML 5 spec, we are removing one newline every time a textarea is edited and then saved, until there are no more. That's what I covered in the PR. |
|
I would expect that the behavior should be to trim text box and text area values before adding them to the database. This would make view and edit behavior consistent, while removing extra blank lines before/after text. |
|
This would mean we have also to trim data entered via SOAP or REST API (hardly a good idea).
so +1 for
|
|
MantisBT: master d975045e 2019-06-05 08:40 Details Diff |
Add newline after <textarea> tags The HTML 5 specification states that "Newlines at the start of textarea elements are ignored as an authoring convenience." [1] To avoid altering user data (e.g. issue description, steps to reproduce, etc.) having leading newline(s) when editing and saving, the markup of all pages displaying user content in textarea tags has been modified to add a newline after the opening tag. Fixes 0025839 [1]: https://www.w3.org/TR/html52/syntax.html#the-in-body-insertion-mode |
Affected Issues 0025839, 0026351 |
|
mod - account_prof_edit_page.php | Diff File | ||
mod - bug_report_page.php | Diff File | ||
mod - bug_update_page.php | Diff File | ||
mod - manage_columns_inc.php | Diff File | ||
mod - manage_custom_field_edit_page.php | Diff File | ||
mod - manage_proj_edit_page.php | Diff File | ||
mod - manage_proj_ver_edit_page.php | Diff File | ||
mod - news_edit_page.php | Diff File | ||
mod - proj_doc_edit_page.php | Diff File | ||
mod - tag_update_page.php | Diff File | ||
MantisBT: master-2.22 9b0dce28 2019-11-13 07:09 Details Diff |
Remove unwanted whitespace in Excel columns textarea Regression introduced by d975045e9a30d253a21662a9c14868ef63f5b5c7. Fixes 0026351 |
Affected Issues 0025839, 0026351 |
|
mod - manage_columns_inc.php | Diff File |