#20 closed defect (bug) (fixed)
Possible for user's to break layout when adding forum posts
Reported by: | siobhyb | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Support Forums | Keywords: | has-patch needs-testing |
Cc: |
Description
When a user wraps text in their forum posts with "<li>" tags - The layout of the page breaks.
For an example of this see - http://wordpress.org/support/topic/please-ignore-just-testing-something?replies=1#post-4430248
Attachments (3)
Change History (32)
#3
@
8 years ago
- Keywords has-patch added
This was brought up in a recent Slack discussion.
meta-20.patch is an experimental patch that wraps standalone <li>
tags in <ul>
:
- Code blocks are not affected, as they are htmlencoded earlier.
- The filter runs on output, so user input is intact.
See before/after screenshots.
Test 1, from @netweb's Code Blocks & Ordered Lists
Input:
<li> <ol> first </ol> <ol> second </ol> </li>
Output:
<ul><li> <ol> first </ol> <ol> second </ol> </li> </ul>
Test 2
Input:
<ul> <li>Unordered list item </ul> <ol> <li>Ordered list item </ol> <li> Code block: ` <li>List item inside code block `
Output:
<ul> <li>Unordered list item </li> </ul> <ol> <li>Ordered list item </li> </ol> <ul><li> Code block: <pre><code> <li>List item inside code block </code></pre> </li> </ul>
This would need some unit test coverage, but the direction seems correct.
This ticket was mentioned in Slack in #bbpress by netweb. View the logs.
8 years ago
This ticket was mentioned in Slack in #forums by sergey. View the logs.
8 years ago
#6
@
8 years ago
Related: #bbPress2357 Design Crashes! - Li button issue - Editor not filtering improper HTML usage.
This ticket was mentioned in Slack in #meta by tellyworth. View the logs.
7 years ago
This ticket was mentioned in Slack in #forums by clorith. View the logs.
7 years ago
#15
@
5 years ago
This is still an issue on bbPress 2.6.3 and meta [9437].
@SergeyBiryukov is the ticket still priority: high?
#16
follow-up:
↓ 17
@
5 years ago
- Resolution set to fixed
- Status changed from accepted to closed
In 9438:
#17
in reply to:
↑ 16
@
5 years ago
- Resolution fixed deleted
- Status changed from closed to reopened
Replying to SergeyBiryukov:
In 9438:
FWIW This seems to not work 100% with lists that have multiple items. I think the regex needs to either support a closing LI element preceding it or something like that.
This is the best example I could come up with: https://wordpress.org/support/topic/this-is-a-test-topic/#post-12379821 The three items should be part of the OL, but instead the second and third LI gets assigned to their own ULs (Which is probably better than the original problem)
#18
@
5 years ago
- Priority changed from high to normal
As the most pressing issue here has been tackled (the layout breaking completely), I feel we can lower the priority here in light of other more relevant tickets at this time.
#20
@
5 years ago
Perhaps we could tighten this up in a different way..
- Match on
<([ou]l)>(.*?)</$1>
to separate it into lists and non-list content - Replace
<li>
with<ul><li>
only outside of the list content matches
#21
@
5 years ago
<ol>
tags seem to be broken at the moment. I'm not sure it's because of nesting tags.
Example POC:
<ol> <li>Some entry.</li> <li>Another entry with `code`.</li> <!-- this is transformed into a new <ul> wrap --> </ol>
I also believe you can completely break the layout using <ol>
with attributes like start
and type
, but I'm not sure if I should test that :)
#22
@
5 years ago
- When I create an ordered list, only the first list element is ordered and the rest are unordered.
<ol> <li>Item 1</li> <li>Item 2</li> <li>Item 3</li> </ol>
Becomes:
<ol> <li>Item 1</li> </ol> <ul> <li>Item 2</li> <li>Item 3</li> </ul>
- When I add an ordered list inside an unordered list item, it becomes unordered.
<ul> <li>Item 1 <ol> <li>Sub Item 1</li> <li>Sub Item 2</li> </ol> </li> <li>Item 2</li> <li>Item 3</li> </ul>
Becomes:
<ul> <li>Item 1 <ul> <li>Sub Item 1</li> <li>Sub Item 2</li> </ul> </li> <li>Item 2</li> <li>Item 3</li> </ul>
https://wordpress.slack.com/archives/C02QB8GMM/p1582996447108500
#23
follow-up:
↓ 25
@
5 years ago
How about taking the Trac ticket and/or Github approach and providing a preview? This way, posters will know what they're about to post and fix most of their own mistakes.
In the preview situation, the system just needs to protect against malice, instead of fixing the formatting for the poster.
#25
in reply to:
↑ 23
@
5 years ago
Replying to galbaras:
How about taking the Trac ticket and/or Github approach and providing a preview? This way, posters will know what they're about to post and fix most of their own mistakes.
This is being tracked in #153 and #3786, currently closed in favor of #bbPress2407.
#26
@
5 years ago
So why not use the suggestion from @netweb to use https://github.com/jawittdesigns/bbpress-live-preview until it's added into bbPress core (maybe, eventually, some day)?
#27
@
5 years ago
Unfortunately https://github.com/jawittdesigns/bbpress-live-preview fatals upon activation, and I'm not sure of what the actual error is. If someone wants to test/patch/fix it we could consider its inclusion on the forums.
I'm going to make an attempt at fixing this shortly, but I'm expecting it'll miss an edge-case.
Nested lists are mostly unsupported and will be converted into non-nested lists instead, not ideal, but should be fine for a forum reply.
The issue is when they use
<li>
without<ul>
and<ol>
wrapping it. Longstanding problem; ideally bbPress is modified to balance these tags for us.I imagine it might also be possible to adjust some CSS to prevent serious breakage. I've never seen such destruction from a missing
<ol>
or<ul>
than I have on wordpress.org/support.