Page MenuHomePhabricator

Topic Subscription Prototype: Highlight thread after following a notification
Closed, ResolvedPublic

Description

Behavior

Actual
When I get a notification (in the echo notification dropdown) saying that someone replied to my conversation on a talk page, it directs me to the thread but doesn't style the thread in any way to make clear to the contributor what part of the page they should look at.

Expected
The thread that's been updated should be highlighted.
The highlight is light blue and never fades.

Event Timeline

Change 683694 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] Highlight target comment when following a link or notification

https://gerrit.wikimedia.org/r/683694

Test wiki created on Patch Demo by JKlein (WMF) using patch(es) linked to this task:

https://patchdemo.wmflabs.org/wikis/3965c25488/w/

Change 683694 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Highlight target comment when following a link or notification

https://gerrit.wikimedia.org/r/683694

Expected
[…]
The highlight […] never fades.

I don’t like when such highlights are “stuck” on the page until I navigate away; maybe I already do something entirely different. I like GitHub’s approach: when I open an anchor link (e.g. https://github.com/wikimedia/parsoid/pull/5#issuecomment-371981298), it highlights the comment, this highlight doesn’t fade out automatically, but it disappears immediately when I click anywhere on the page outside of that comment.

Screenshot_2021-05-27 Talk Main Page – Patch Demo (683694,1).png (62×423 px, 10 KB)

Is this really how it should look like? The highlight expands in height to approximately the half of the previous comment. (Firefox 78.10.0esr, Debian 10.)

Expected
[…]
The highlight […] never fades.

I don’t like when such highlights are “stuck” on the page until I navigate away; maybe I already do something entirely different. I like GitHub’s approach: when I open an anchor link (e.g. https://github.com/wikimedia/parsoid/pull/5#issuecomment-371981298), it highlights the comment, this highlight doesn’t fade out automatically, but it disappears immediately when I click anywhere on the page outside of that comment.

That's interesting, I never noticed that before. I think we're open to changing that, although it might also be weird in some cases (e.g. if the highlight would disappear when you click [reply]).

Also, to clarify, "the highlight never fades" only means that it's not on a timer (it doesn't fade by itself), but it is removed if you navigate to a different anchor on the page, e.g. by clicking a section in the table of contents.

Screenshot_2021-05-27 Talk Main Page – Patch Demo (683694,1).png (62×423 px, 10 KB)

Is this really how it should look like? The highlight expands in height to approximately the half of the previous comment. (Firefox 78.10.0esr, Debian 10.)

No, it shouldn't look like that. I didn't test it on Firefox, I didn't really expect it to behave differently.

It's actually interesting why that happens. We use the Range#getBoundingClientRect method to determine where to draw the highlight, using a range that covers the whole comment, and starts inside the "start marker" of the comment. The start marker node also serves as the anchor target, and for that purpose, it's positioned slightly above the comment text, so that tall characters don't touch the edge of the screen when your browser scrolls to it. It looks like Chromium ignores that element when computing the bounding rect, but Firefox does not. Firefox's behavior actually feels more correct here, now that I think about it.

We should be able to fix this by adjusting the range to start after the marker, instead of inside of it.

Change 696509 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] Adjust comment ranges to exclude the start/end markers

https://gerrit.wikimedia.org/r/696509

Change 696509 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Adjust comment ranges to exclude the start/end markers

https://gerrit.wikimedia.org/r/696509

Change 696617 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] Follow-up: Adjust comment ranges to exclude the start marker *only*

https://gerrit.wikimedia.org/r/696617

matmarex removed a project: Editing QA.

My bad, that patch is broken…

Change 696617 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Follow-up: Adjust comment ranges to exclude the start marker *only*

https://gerrit.wikimedia.org/r/696617

Also, I noticed more issues: the highlight doesn't move when opening reply tool, or collapsible stuff, or disappear when opening VE.

Looks like we need to put more thought into "permanent" highlights.

Change 697447 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/extensions/DiscussionTools@master] Change how highlights are positioned to work better with unaware tools

https://gerrit.wikimedia.org/r/697447

Change 697447 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Change how highlights are positioned to work better with unaware tools

https://gerrit.wikimedia.org/r/697447

Test wiki created on Patch Demo by JKlein (WMF) using patch(es) linked to this task:

https://patchdemo.wmflabs.org/wikis/2d0402d719/w/

Test wiki on Patch Demo by JKlein (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/2d0402d719/w/

Test wiki on Patch demo by JKlein (WMF) using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/3965c25488/w/