Problem/Motivation

When a theme defines a different color for visited links, this custom color can be seen in the toolbar on visited links as well.

Steps to reproduce

In a theme CSS file, define a color for visited anchors:

a:visited {
    color: red
}

Notice red links appearing in the toolbar for pages you have visited.

Observed behavior

Proposed resolution

Toolbar already defines the colors for all other states. The visited state can best be appended to the first group I think.

.toolbar-tray a {
  padding: 1em 1.3333em;
  cursor: pointer;
  text-decoration: none;
  color: #565656;
}
.toolbar-tray a:hover,
.toolbar-tray a:active,
.toolbar-tray a:focus,
.toolbar-tray a.is-active {
  text-decoration: underline;
  color: #000;
}

Remaining tasks

Update CSS to:

.toolbar-tray a,
.toolbar-tray a:visited, {
  padding: 1em 1.3333em;
  cursor: pointer;
  text-decoration: none;
  color: #565656;
}

User interface changes

Minor improvement; the toolbar is no longer affected by the theme.

API changes

None

Data model changes

None

Release notes snippet

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Neograph734 created an issue. See original summary.

Neograph734’s picture

Neograph734’s picture

Issue summary: View changes
FileSize
28.04 KB
ranjith_kumar_k_u’s picture

FileSize
254.14 KB
233.03 KB

The patch works fine

Before patch
before patch

After patch
after patch
RTBC

Neograph734’s picture

Status: Needs review » Reviewed & tested by the community

Considering the triviality of the change, I think that one RTBC should be enough.
Thanks for testing ranjith_kumar_k_u.

Gauravvvv’s picture

Patch #2, seems fine to me.
RTBC +1.

Status: Reviewed & tested by the community » Needs work
Neograph734’s picture

Status: Needs work » Reviewed & tested by the community

That seems unrelated. Back to RTBC.

Status: Reviewed & tested by the community » Needs work
Neograph734’s picture

Status: Needs work » Reviewed & tested by the community

And again an unrelated fail.

Status: Reviewed & tested by the community » Needs work
Neograph734’s picture

Status: Needs work » Reviewed & tested by the community

Well...

Spokje’s picture

This time it was caused by #3207086: [HEAD BROKEN] Consistent failure in MonthDatePluginTest which was fixed.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Status: Reviewed & tested by the community » Needs work
catch’s picture

Status: Needs work » Reviewed & tested by the community

Restoring status after HEAD was broken.

lauriii’s picture

Status: Reviewed & tested by the community » Needs work

This CSS is overridden in Stable and Stable 9, which many themes use as a base theme. This seems like a nice non-disruptive bug fix which we should do in Stable and Stable 9 too.

imalabya’s picture

Added a patch for Stable and Stable9 themes.

Neograph734’s picture

Well, I just learned that the toolbar uses the admin theme instead of the page theme. During testing I could not get the red links to go away... Until I figured that Claro also defined them.

Fix includes Claro as well.

Neograph734’s picture

And now including the commas. Not sure why they not copied over...

vikashsoni’s picture

Applied patch working fine
for ref sharing screenshot

radheymkumar’s picture

Patch working fine
Thanks for the patch

Neograph734’s picture

@vikashsoni and @radheymkumar, thanks for your reviews, but the attached screenshots do not help.

Before patch should be red letters and after patch the letters should be black. The pictures now show that the patch is making red letters!?

Could you please doublecheck? If all is good we can change to RTBC.

bnjmnm’s picture

Removing credit for #22, adds a screenshot of the exact same thing provided in the previous comment is redundant and adds noise to the issue.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

sonam.chaturvedi’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
157.21 KB
161.39 KB
25.33 KB

Verified and tested patch #20 on 9.5.x-dev. Patch applied successfully.

Test Steps:
1. Login to drupal site
2. Visit various toolbar links
3. Inspect and Verify theme css is updated as below

.toolbar-tray a,
.toolbar-tray a:visited, {
  padding: 1em 1.3333em;
  cursor: pointer;
  text-decoration: none;
  color: #565656;
}

4. Now update theme css as below

a:visited {
    color: red
}

5. Check colors for visited does not bleed into the toolbar
6. Verify above steps for Claro theme as well

Test Results:
1. Theme css is updated as expected.
2. Even after adding "a:visited { color: red }" css > Color do not bleed. toolbar-tray css overrides the anchor link css for toolbar menus. Good
3. Content links and toolbar visited color works as expected for Claro theme.

Before patch:
bef patch 20

After patch:
after patch 20

after patch css

Moving to RTBC

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed 75514e16b6 to 10.1.x and f550c1875d to 10.0.x. Thanks!
Committed 7d191e4 and pushed to 9.5.x. Thanks!

Removed credit for duplicate screenshots. Credited @sonam.chaturvedi because #27 was very explicit about steps taken.

  • alexpott committed 75514e1 on 10.1.x
    Issue #3195033 by Neograph734, imalabya, sonam.chaturvedi,...

  • alexpott committed f550c18 on 10.0.x
    Issue #3195033 by Neograph734, imalabya, sonam.chaturvedi,...

  • alexpott committed 7d191e4 on 9.5.x
    Issue #3195033 by Neograph734, imalabya, sonam.chaturvedi,...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.