Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
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
Comment | File | Size | Author |
---|---|---|---|
#27 | After-patch-css.png | 25.33 KB | sonam.chaturvedi |
#27 | After-patch#20.png | 161.39 KB | sonam.chaturvedi |
#27 | before_patch#20.png | 157.21 KB | sonam.chaturvedi |
#22 | Screenshot from 2021-10-27 14-17-05.png | 17.62 KB | radheymkumar |
#21 | After--patch--pic.png | 27.27 KB | vikashsoni |
Comments
Comment #2
Neograph734Comment #3
Neograph734Comment #4
ranjith_kumar_k_u CreditAttribution: ranjith_kumar_k_u at Zyxware Technologies commentedThe patch works fine
Before patch
After patch
RTBC
Comment #5
Neograph734Considering the triviality of the change, I think that one RTBC should be enough.
Thanks for testing ranjith_kumar_k_u.
Comment #6
Gauravvvv CreditAttribution: Gauravvvv at OpenSense Labs commentedPatch #2, seems fine to me.
RTBC +1.
Comment #8
Neograph734That seems unrelated. Back to RTBC.
Comment #10
Neograph734And again an unrelated fail.
Comment #12
Neograph734Well...
Comment #13
SpokjeThis time it was caused by #3207086: [HEAD BROKEN] Consistent failure in MonthDatePluginTest which was fixed.
Comment #16
catchRestoring status after HEAD was broken.
Comment #17
lauriiiThis 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.
Comment #18
imalabyaAdded a patch for Stable and Stable9 themes.
Comment #19
Neograph734Well, 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.
Comment #20
Neograph734And now including the commas. Not sure why they not copied over...
Comment #21
vikashsoni CreditAttribution: vikashsoni as a volunteer and at Zyxware Technologies commentedApplied patch working fine
for ref sharing screenshot
Comment #22
radheymkumar CreditAttribution: radheymkumar commentedPatch working fine
Thanks for the patch
Comment #23
Neograph734@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.
Comment #24
bnjmnmRemoving credit for #22, adds a screenshot of the exact same thing provided in the previous comment is redundant and adds noise to the issue.
Comment #27
sonam.chaturvedi CreditAttribution: sonam.chaturvedi at Salsa Digital commentedVerified 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
4. Now update theme css as below
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:
After patch:
Moving to RTBC
Comment #28
alexpottCommitted 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.