WIP: Improve style for quoted text in RichContent #412
No reviewers
Labels
No labels
a11y
Bug
Bug fix
Critical Priority
Documentation
Feature
Feature request
Held for next release cycle
High Priority
Low Priority
Medium Priority
Minor change
Translation/Locale
WIP
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma-fe#412
Loading…
Reference in a new issue
No description provided.
Delete branch "ilja/akkoma-fe:improve_visual_style_for_quoted_text"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Previously quoted text (e.g. in Markdown
> Some text
) was italicWhen two different quotes were made, there was no distinction between the two, making it look like one quote
This is confusing
Now we have a vertical line in front of the quote
When two different pieces of text are quoted, it is now clear because the lines are separated
This vertical line is a typical way of visualising quoted text, so it should be easy to understand what it is
Examples:
One problem I see with this is when reparsing MFM from *key instances... See https://ilja.space/notice/Al8CNka0RS1GrnMnrc
Consider the following as input for MFM:
Akkoma will consider this part of the same quote, *key will only consider the first line as a quote, not the second one.
Before this PR the same thing is true, but bc the quotes are basically just italics, it may be less obvious.
I don’t think the pre-existing MFM inportability is a blocker; apart from italic quotes wree already indented before so this wasn’ŧ really better before.
Note there’s also a pre-existing vertical spacing issue; see: #347. It still exists but isn’t introduced by the changes here. The apparently relevant whitespace classes are beyond my CSS knowledge; if you know more and can fix this properly great, otherwise a quick hack to paper over it though is adjusting margns to
margin: 0.2em 0 1.0em 0.2em
@ -5,0 +3,4 @@
margin: 0.2em 0 0.2em 0.2em;
padding: 0 0 0 1em;
border-width: 0 0 0 0.3em;
border-style: solid;
suggestion, not a blocker: i’ve also commonly seen text colour being a bit more muted for quoted sections. We could achieve this with something like this:
or introduce a new style property for quoted text colour. The former may be undesirable in some themes whose text has a poor contrast by default.
yeah i think i agree, muted quotations seems to be the norm
Is fixed for making it faint. I did the same way as how making text faint is done in other locations. It's the same as e.g. the timestamp right-top of the status.
When making a theme for akkoma-fe, there's a check for how readable things remain. I'm unsure how that exactly works, but by using the same way of doing this, i'm assuming this is also taken into account for the theming engine.
There's still some weirdness with space, but that was already a problem. I'll see if I can figure out what's going on there.
Here's how it looks now, and i'm taking the opportunity to show how nested quotes are also nicely working ^^
And how it is without these changes
The comment about the space between a paragraph and blockquote is now also fixed 🎉
The reason is; p-tags only have margin at the bottom. Blockquotes are block elements on their own, but the margin was different. This gave this problem. See screenshots
Here we check the p-tag. We see there's only a margin at the bottom. That margin is 1em and is what's pushing the next block 1em down.
But when we check the blockquote, we see it has margins all around. All are 0.2em, so it only pushes the block below 0.2em down. Between it and the block above, the space is 1em, because there the p-tag has it's 1em margin.
Other block elements I can think of who may have similar problems are code, ul and ol-tags. I checked those, and visualy they seem OK. Checking with developer tools (F12 in browseer), it seems they have 1em margin bottom and top, always. We could nitpick wether those should be better to have 0 as last-child, and if they need the margin-top, but if someone wants that, I prefer to have that discussion somewhere else and keep this MR to the blockquotes. If we have that discussion, we should start by checking what elements we allow through the scrubber.
That leaves the problem of the blockqoute looking weird when it comes after a mention, I'll see if I can figure that one out too.
That last problem is also fixed with #347 already. Is there a reason why #347 is still open? Because I think it makes more sense to merge that first. After that I can fix merge conflix on this PR, and then we'll have nice looking quote posts.
hm 🤔 I do wonder why that
is for. When I just remove it, it also works. AND when I remove it, codeblocks work better imo. The change in #347 makes the lines "wrap". By removing it, we get a scrollbar.
This is with removing the line
This is with the fix from #347
I'll make the commit as the first example (where we have the scroll bar) and leave it up to others to decide what they like best.
Pushed, I think it's good now. Here's a last screenshot showing blockquotes and different spacings.
Seems it was an akkoma regression when trying to get mfm to work. Before that, the code I now removed was also just not there. I'm unsure why it was added.
$[spin something]
seems to still work for example.@nbsp Do you happen to remember what this
white-space: pre-wrap
was for (just to be sure we're not breaking other things)? In src/components/status_body/status_body.scsscommit:
931ed3d3c7 (diff-4200029adfe97f22b2316110f9e4adafca58f990)
pr: #29
EDIT: Nevermind, I think I found it. E.g.
$[spin 🥴]
, the whitespace needs to be preserved. Withoutthis line, it collapses to one whitespace. This isn't purely an MFM thing, but I understand that it was added to get better MFM integration.Seems to work fine in testing; thanks!
Nice find re
--faint
.I’m not really qualified to judge the
whitespace: pre-wrap
stuff, but the explanation sounds convincing and i didn’t encounter any obvious issues so far. With the scroll bar disappearing by default in Firefox at least, the presence of overflowed content might not be obvious if the overflow occurs within whitespace or on a character boundary, but this is a matter for a different PR imho (e.g. distinguishing code blocks with a different background colour, which might also necessitate a different text color for readability unless we already have something fitting?)heh, something I just noticed.
Here's a post with a quote
Here's the same post when I select it in a thread
Note that the second one doesn't look fainted any more. And indeed, I did it the same as the timestamp and that one doesn't look faint any more either.
Honestly, I like it like this. It's fainted in "normal" situations, but when you select it, it's more readable. I see that e.g. the globe still looks faint, so I could probably change it to keep the quote look faint too, but personally I think it's better as it is now.
Improve style for quoted text in RichContentto WIP: Improve style for quoted text in RichContentI discovered why the
whitespace: pre-wrap
is there. Without it, whitespaces will collapse into one space. See screenshots. For some reason, keeping the spaces only happens with Markdown and MFM (who also uses Markdown). I'm assuming we should keep the white space for MFM compatibility.With
whitespace: pre-wrap
we see on the first line that spaces are preserved. But it makes blockquotes slightly weird after a mention and a space:Without
whitespace: pre-wrap
we see on the first line that spaces are not preserved. The weird blockquote thing is fixed:My conclusions:
What now:
I reverted that "fix" now. This means that spaces are preserved again (good), but in some specific occasions the blockquotes will have an empty space above them (less good).
The current improvements are
The bad thing is the weirdness with block quotes after a mention. I'm not very happy with how it is now, but I'm also not sure I want to spend more time on this at this moment since this was meant to be a quick fix...
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.