Closed akien-mga closed 6 years ago
On my machine:
On Chrome 60.0.3112.78 on Ubuntu:
On FF Nightly on Ubuntu:
Thanks for testing, I'll have to recheck on Nightly - I wrote these steps to reproduce based on Chrome behaviour, and I remember having similar pill issues on Nightly, but maybe the exact behaviour differs.
This is probably because there's an "R" for the avatar of this person. Draft-js has a bug where it expects the text inside the pill to be exactly the text it decorates - https://github.com/vector-im/riot-web/issues/4772. This leads to all sorts of exciting misbehaviour.
I checked again on FF Nightly on Mageia 6 x86_64 (Linux), and the bug described above is worse. With the exact same steps to reproduce, the final output is:
And the text editor is then completely broken:
Rreduz ,, Rreduz ,,
cannot be deletedHelp!! Rreduz ,,
(notice the absence of the second instance of this pill leftover).The above actually covers what I had mentioned in the OP:
Note that it's only one breaking case, I've experienced similar (and more blocking, needing a refresh of Riot) issues in slightly different scenarios for which I haven't debugged the exact steps to reproduce yet. I may describe them later on here or in a new issue when I come to that.
A workaround for this could be to not have any text in the member avatar in pills. I'm not sure what we'd put there instead. Maybe no avatar? Maybe a placeholder image?
Could the issue be sidestepped by using an SVG "image" containing the text?
This bug is super-annoying (as per #5002 - @turt2live thanks for spotting the dup :)
I suspect @eternaleye's solution is a fine workaround: i.e. rather than putting a <span>R</span>
in the avatar, we can put a <svg><text>R</text></svg>
instead, and hopefully Draft.js won't overenthusiastically try to parse text out of the SVG.
@ara4n: Even if it does, there's always <img src="data:..."></img>
as a fallback option. That'd definitely behave more like an actual avatar.
Breakage with different symptoms:
multiple issues affecting Riot
… around 01:18 on the timeline: …
<svg><text>R</text></svg>
SGTM
OK so it turns out that the SVG <text/>
is still a text node in the DOM, it's not just rasterized once.
@lukebarnard1: What about an <img>
with a data:
URI?
@eternaleye this would strictly be an option. But we do lose the CSS, which means themeing won't work.
@lukebarnard1: I thought the SVG was just for the letter itself, though, not even the background? At that point, we don't "lose the CSS" any more than we do when a user has an avatar set...
By CSS I meant we lose the ability to apply a different colour to the initial through the existing theme mechanism.
¡Hola @ara4n!
This just bite me yet again on https://riot.im/develop/ and annoyed me enough to comment.
Any hopes for a fix or workaround to this bugger?
¡Gracias!
This bit me just now on Firefox 57.0 (Quantum) as well. So just a +1.
+1 too
fixed in matrix-org/matrix-react-sdk#1890
Description
After inputting a pill mention (start typing user name and tab-complete it), resulting in e.g. if you attempt to edit the trailing colon to change it e.g. in a comma using backspace, you may end up breaking the pill and have instead:
I'll describe the exact steps to reproduce below. Note that it's only one breaking case, I've experienced similar (and more blocking, needing a refresh of Riot) issues in slightly different scenarios for which I haven't debugged the exact steps to reproduce yet. I may describe them later on here or in a new issue when I come to that.
Steps to reproduce
red<TAB>
and get it completed as: Note that the cursor is two columns after the pill, preceded by a colon and a space.(*) One could expect that the cursor is inside the pill to allow appending to the username (e.g. to mention
@reduzio
instead of@reduz
, but in all evidence it does not work, as the first added character is inputted after the pill without moving the cursor, and the second one breaks the pill:i
:o
:Also worth mentioning, waiting long enough (5 s) between keystrokes allows to continue inputting stuff according to the 2. (a) logic.
Version information
For the web app: