Opened 9 years ago
Closed 9 years ago
#35479 closed defect (bug) (fixed)
Text editor not honoring paragraph markup
Reported by: | arush | Owned by: | arush |
---|---|---|---|
Milestone: | 4.5 | Priority: | normal |
Severity: | normal | Version: | |
Component: | TinyMCE | Keywords: | |
Focuses: | accessibility | Cc: |
Description
When writing a post in the text editor, any paragraph markup (<p> ... </p>) tags are stripped when switching to the visual editor. If switching back from the visual editor to the text editor, the code is stripped out of the post and has to be re-added. In other words, switching back and forth between editors appears to not be ideal, as you will lose formatting markup.
Attachments (2)
Change History (23)
#2
@
9 years ago
- Keywords close removed
Hi @arush :) yep the paragraph tags are stripped out and replaced with empty lines. That's a "feature", a bit confusing if reading the code with a screen reader yeah. When rendering the post on the front end, then paragraphs are added automatically. So when writing a post all you have to do is inserting an empty line between block of text and they will become paragraphs.
Maybe this feature should be better explained in the Help, any thoughts?
#4
@
9 years ago
If this is a feature, and not a bug, we should probably explain this better in the help. This was first brought to my attention by a sighted user, and it admittedly causes problems for myself as well, so something as to why it's intentional would also be of help. After all, if we're calling it a text editor, and telling people to write code in it, then those of us who write markup in it are going to expect that are markup is handled correctly.
#5
@
9 years ago
- Status changed from new to closed
I get that we're going to block some tags, but if we're going to do that, can't we block things like <div> or <main> since those, for example, should be handled by the theme and not entered in by content managers?
#6
@
9 years ago
- Keywords 2nd-opinion added
- Status changed from closed to reopened
- Version 4.4.1 deleted
#7
@
9 years ago
The Help text could be improved a bit. Currently, the relevant part is:
The Text mode allows you to enter HTML along with your post text. Line breaks will be converted to paragraphs automatically.
It does say that line breaks will be converted to paragraphs but it also says it "allows to enter HTML" and a <p>
tag is HTML :) so for some users having paragraphs stripped out could be unexpected and a bit confusing.
Also, wondering how many users know what "WYSIWYG" means. The expanded form probably won't help so much. What about to change the sentence and just say what it does and not what it is?
This ticket was mentioned in Slack in #accessibility by afercia. View the logs.
9 years ago
#9
@
9 years ago
- Keywords 2nd-opinion removed
- Milestone changed from Awaiting Review to 4.5
Agree we need better explanation of how the Text editor behaves (wpautop). We can update the text in 4.5 until strings freeze if there is a patch or suggestion :)
This ticket was mentioned in Slack in #core by chriscct7. View the logs.
9 years ago
#11
@
9 years ago
Proposal for modified text:
The Text editor allows you to enter HTML along with your post text. While most tags are honored, the exceptions are the paragraph (<p> </p>) tag and the line break (<br> or <br> />) tag. This is because WordPress converts single presses of the "enter" key to <br>, and two presses of the "enter" key to <p>. If you are an accessibility professional who has spent time training your clients to enter properly formed HTML, and you do not want WordPress to make this decision for you or your clients, you can either disable the wpautop filter within your theme's functions.php file, or install a plugin that will disable this functionality and give you complete control of the markup you enter.
#13
follow-up:
↓ 14
@
9 years ago
This text is confusing, good idea to clean it up. I'd like to keep this succinct while still better explaining how <br> and
<p>` tags are stripped if you switch from text to visual editing modes. How about:
The Text mode allows you to enter most HTML along with your post text. Note that <p> and <br> tags are converted to line breaks when switching to the visual editor.
#14
in reply to:
↑ 13
@
9 years ago
Replying to adamsilverstein:
This text is confusing, good idea to clean it up. I'd like to keep this succinct while still better explaining how
<br> and
<p>` tags are stripped if you switch from text to visual editing modes. How about:
The Text mode allows you to enter most HTML along with your post text. Note that <p> and <br> tags are not honored since single and double line breaks are automatically converted.
I think this is good. I've changed the text above somewhat since this applies regardless of editor.
#15
follow-up:
↓ 16
@
9 years ago
Yep, that sounds good, only P and BR are converted when switching from Visual to Text, not the opposite :)
So how about:
The Text mode allows you to enter most HTML along with your post text. Note that <p> and <br> tags are converted to line breaks when switching to the Text editor to make it less cluttered. They are converted back to tags in the Visual editor.
#16
in reply to:
↑ 15
@
9 years ago
Replying to azaozz:
Yep, that sounds good, only P and BR are converted when switching from Visual to Text, not the opposite :)
So how about:
The Text mode allows you to enter most HTML along with your post text. Note that <p> and <br> tags are converted to line breaks when switching to the Text editor to make it less cluttered. They are converted back to tags in the Visual editor.
Yep, this'll do it.
#17
@
9 years ago
Maybe even better if there is some help for the Text editor:
The Text mode allows you to enter most HTML along with your post text. Note that <p> and <br> tags are converted to line breaks when switching to the Text editor to make it less cluttered. When you type, a single line break can be used instead of typing <br>, and two line breaks instead of paragraph tags. The line breaks are converted back to tags in the Visual editor.
Will have to expand "WYSIWYG" too. Not sure how many people have ever heard that. Probably good if we can drop it completely.
#18
@
9 years ago
Yeah probably needs to be some help for the text editor. Hang on, let me grab the latest trunk and add. I think I can submit a patch for these.
#19
@
9 years ago
@arush sure, I got to here: https://core.trac.wordpress.org/attachment/ticket/35479/35479.patch. Feel free to edit :)
@
9 years ago
Adds corrected documentation in the help section as discussed in the comments, and expands WYSYWYG editor to "an editor that is similar to a word processor"
That's intentional.
<p>
tags are added automatically on output usingwpautop()
.