[Hide Details] Button not functioning: splitting text into multiple details!

AI-generated summary

The [Hide Details] Button is not functioning correctly, splitting text into multiple details instead of keeping it in a single block. AnimeCanuck reported this issue, which can be easily replicated by selecting text with multiple lines and clicking the [Hide Details] button. The desired behavior would be to keep the text together, but instead, it creates separate details blocks for each line.

xrav3nz was able to reproduce the issue and has created a pull request to fix it, adding a test to ensure the correct behavior. The issue is believed to be a regression, potentially caused by a previous commit by @sam.

Hi, I’m not a host but rather a user of the WaniKani forums, and since this was not a bug for them, I thought I wouldn’t pester Viet. Any Details-related bugs that came up in the search were locked.

So first of all, writing the Details tag manually around the text does not seem to be working. So then I thought I was typing it incorrectly/didn’t leave enough spaces before/after my text.
So I tried using the button under the GEAR button to add details to selected text:

This used to function normally as desired, and then you could replace “Summary” with whatever title your heart desired. However over here at this post the button instead applied the details tag around every separate line of text. Seeing this in my text box, I didn’t even bother to edit my post, but instead came here to report it. I shall try to recreate it here as an example, because it is very odd behaviour.

Summary

Hello, this is a block of text.

Summary

It has multiple lines, because I like the enter key.

Summary

Doesn’t everyone?

Summary

Extra text to prove my point.

EDIT: That was a small four-line paragraph with enters between each line. And that’s what the Details Button did to my text. Point proven. Very easy to replicate. Not just a problem at community.wanikani.com.

Anyone else having this issue?

1 « J'aime »

Reproduced this on meta:

// If the editor contains the following text
first line
second line

// Selecting them and clicking the `Hide Details` button would produce:
[details="Summary"]
first line
[/details]


[details="Summary"]
second line
[/details]

// While the desired behaviour should produce:
[details="Summary"]
first line
second line
[/details]

Took the liberty to fix it and added a test:

https://github.com/discourse/discourse/pull/5290


P.S. I did notice @sam’s previous commit, but I believe the { multiline: true } change was unintentional.

6 « J'aime »

Hmm is this a regression @sam?

I guess it is … looks like it.

1 « J'aime »

This topic was automatically closed after 41 hours. New replies are no longer allowed.