Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XWIKI-22120: Live Data links are underlined although 'Underline links' setting is set to 'Only Inline Links' #3085

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sereza7
Copy link
Contributor

@Sereza7 Sereza7 commented Apr 25, 2024

Jira URL

https://jira.xwiki.org/browse/XWIKI-22120

Changes

Description

  • Added an exception in the only inline link rules to not underline links in link displays in livedatas.
  • Updated the UserDisplay velocity template:
    ** Replaced the user avatar alternative text.
    ** Moved the avatar inside of the link. This provides multiple benefits one of which is that now the link hits the :has(img) selector to prevent underlining :)

Clarifications

  • I decided to avoid systematically removing underlining from livedatas. Therefore the issue resolution is split in two parts, each for one of the columns in the table reported. I tried to make those solutions as generic as possible to cover as many columns where this would be needed as possible.
  • The alt from the user avatar was repetitive with the text after. This user avatar does not convey any specific meaning, and similarly to icons it should be indicated that it is semantically irrelevant. That's why we keep an empty alt property on the picture.
  • Moving the avatar inside of the link provides multiple benefits:
    ** the avatar can now be clicked to follow the link.
    ** the link hits the :has(img) selector to prevent underlining :) This selector is quite generic and added for cases such as this one :)

Screenshots & Video

All screenshots here display UI examples after the changes proposed in this PR. The current user is the wiki admin and has the Only inline link underlining preference selected.

image
We can see that the reported issue is solved, the links in the table are not underlined anymore :)
image
The change to the structure of the DisplayUser template might break some UI. However we can see here that this UI relying on an avatar wrapper is doing alright. Note that most of the styles about this template come from

. We can see in here that it's loosely defined enough so that no ruleset is completely lost (no use of > direct child operators, so moving the avatar down a level does not break any selector here).

Executed Tests

Manual tests with Firefox as seen above.

Expected merging strategy

  • Prefers squash: Yes
  • Backport on branches:
    • No backport. The avatar move might create a regression on some style somewhere, it's a bit dangerous. This issue is not critical to fix for XWiki16.3.0 AFAIK.

…' setting is set to 'Only Inline Links'

* Added an exception in the only inline link rules to not underline links in link displays in livedatas.
* Updated the UserDisplay velocity template:
** Replaced the alt from the picture (which was repetitive with the text after). This user avatar does not convey any specific meaning, and similarly to icons it should be indicated that it is semantically irrelevant.
** Moved the avatar inside of the link. This provides multiple benefits one of which is that now the link hits the `:has(img)` selector to prevent underlining :)
@@ -318,10 +318,12 @@ $xwiki.getUserName("xwiki:${username}")
## We avoid the whitespace because the users are displayed as inline blocks.
#set ($discard = $output.addAll([
"<$userTag class=""$type"" data-reference=""$escapetool.xml($userReference)"">",
"<$userNameTag $userNameTagAttributes>",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change feels a bit dangerous: you're changing the DOM for the display of #displayUser which is a very used macro. It's probably harmless but at the very least I would run a few integration tests, maybe flamingo-skin-test-docker.

And we probably should discuss such change in the future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't you match the user-name or group-name class attribute instead of modifying the HTML?

@@ -175,7 +175,8 @@ body.content {
& .xtree,
& .xwikitabbar,
& .buttonwrapper,
& #user-menu-col {
& #user-menu-col,
& .xwiki-livedata .cell .displayer-link {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the breadcrumb in the location column in Live Data would remain underlined? Seems inconsistent to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants