Space after task ref can get visually consumed

Reproduction Instructions

  1. Create or edit a task to have a title that ends with a full-stop and a trailing space. E.g. "Foo bar. "
  2. Refer to this task in a comment as Foo {T123} (bar).

Phabricator/Arcanist Version

Skipping since its reproducible on secure.phabricator.com currently as well (I first noticed it on phabricator.wikimedia.org).

For example, at https://secure.phabricator.com/T13653:

This sounds very similar to {T2823} (ref T2717). 

Preview:

Then using dev tools to add a fullstop and space:

Original live example: https://phabricator.wikimedia.org/T282844#7087062

Just to make sure I understand this issue:

  • If a task title ends in a whitespace (or is it a specific whitespace char?)
  • And the task is then referenced using {T123} syntax
  • Then the whitespace between the task reference span and the next word is not shown (but the whitespace inside the span is shown).

Is this description correct?

I’m pretty sure this is just arising from HTML space behavior. Consider this:

<div style="letter-spacing: 18px">
  <span style="background: #fdd;">A B C </span> D E F
</div>

…which renders as:

That is, the space between </span> and D is not rendered visually.

This seems like an edge case with little real fallout, presumably rooted in browsers following the spec. I don’t know of any way to fix it that doesn’t have a ton of fallout in other more common cases (or printing, or accessibility, or something).

A more general example is that the inputs a_b (with one space) and a______b (with many spaces) both produce the same rendered output, as though a and b were separated by a single space.

I understand that the trimming is a side-effect of how the browser behaves. It is not unsolveable though. Phabricator could make a domain-specific decision, knowing the elements at play, and choose to prioritise the spacing in the comment over the trailing space in the task title. This might be reasonable considering that it is also Phabricator choosing to draw a rectangle around the inline block element.

The way this would work is that we would e.g. rtrim() the text rendered inside such phui-tag elements.

Alternatively, more specifically to Maniphest tasks, one could decide that trailing spaces in titles are undesirable/unintentional and normalise those away more generally when saving or retreiving that information from the database.