Problem/Motivation

#3083850: Darker blue color for :hover & :active broke the hover and the active styles of the default link buttons.

To reproduce:

  1. Visit /admin/structure/block with Claro theme set as admin theme.
  2. Hover (or long-click) any of the Place block buttons next to the region name.

Block layout form's Place block button hovered in Claro theme

Proposed resolution

Don't change the text color of link buttons.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

huzooka created an issue. See original summary.

sd9121’s picture

Assigned: Unassigned » sd9121
sd9121’s picture

Fixed default link button styles issue.

sd9121’s picture

Assigned: sd9121 » Unassigned
Status: Active » Needs review
ant1’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

Needs reroll because of commit #3088805: Simplify Claro's CSS directory structure.
Also it is requested to fix the styling of only the link button. The provided patch removes the styling for all links.

sd9121’s picture

Rerolled the patch and fixed the styling of only the link button.

sd9121’s picture

Status: Needs work » Needs review
asmita26’s picture

Assigned: Unassigned » asmita26
asmita26’s picture

Assigned: asmita26 » Unassigned

Tested the styling issue and it is working fine as intended.

asmita26’s picture

Status: Needs review » Reviewed & tested by the community
lauriii’s picture

Status: Reviewed & tested by the community » Needs work

The patch needs a reroll against Drupal Core

hash6’s picture

I am working on adding a patch reroll @lauriii

hash6’s picture

Assigned: Unassigned » hash6
hash6’s picture

Updated the patch for Drupal Core.

hash6’s picture

Status: Needs work » Needs review
lauriii’s picture

Status: Needs review » Needs work
Issue tags: -Needs reroll

We need to also add these changes to the source file button.pcss.css.

hash6’s picture

Status: Needs work » Needs review
FileSize
1.63 KB

Updated the code to source file button.pcss.css. Thanks @lauriii

lauriii’s picture

Status: Needs review » Needs work
+++ b/core/themes/claro/css/components/button.pcss.css
@@ -168,3 +168,13 @@
+a.button:hover {
+  color: var(--button-fg-color-active);
+}
+a.button:focus {
+  color: var(--button-fg-color-focus);
+}
+a.button:active {
+  color: var(--button-fg-color-active);
+}

Sorry but I just realized that all different button states use the same color. 🤦I would convert this into a single rule set that is using var(--button-fg-color); to set the color.

We will also have to take into account different variations such as .button--danger and .button--primary.

hash6’s picture

Status: Needs work » Needs review
FileSize
1.18 KB

Added the css code for button links and it will prevent affecting button--primary , button--danger classes as new css code's placement is before css added for button--primary and button--danger.

hash6’s picture

Updated the styling to include a.button--primary and a.button--danger styling which will be of higher weight and tested it on pages like custom block library page where we have button--primary for add custom block.

lauriii’s picture

Status: Needs review » Needs work

Thank you! This looks very close to done!

  1. +++ b/core/themes/claro/css/components/button.css
    @@ -162,15 +162,30 @@
    +a.button--primary:hover,
    +a.button--primary:active {
    +  color: #fff;
    +}
    

    Nit: let's move this after other rules related to this.

  2. +++ b/core/themes/claro/css/components/button.css
    @@ -162,15 +162,30 @@
    +a.button--danger:hover,
    +a.button--danger:active {
    +  color: #fff;
    +}
    

    Let's group this together with the other .button--danger rules.

  3. +++ b/core/themes/claro/css/components/button.css
    @@ -162,15 +162,30 @@
    -  color: #fff;
    

    Wouldn't the .button:hover styles override the default styles for .button--primary if we removed this?

hash6’s picture

Status: Needs work » Needs review
FileSize
1.79 KB

Updated the styling as per the suggestions.

lauriii’s picture

Issue summary: View changes
Status: Needs review » Needs work
FileSize
9.22 KB
+++ b/core/themes/claro/css/components/button.css
@@ -162,6 +162,12 @@
+a.button:focus,

We should remove the focus state from here given that the a element doesn't set color for this state. This causes some issues with the other variations.

hash6’s picture

removed the :focus as per the suggestion.

hash6’s picture

Status: Needs work » Needs review
lauriii’s picture

Assigned: hash6 » Unassigned
Status: Needs review » Reviewed & tested by the community

Awesome! Tested default, primary and danger variations of a.button in all states (hover, active and focus) and all worked as expected. Thank you @hash6 for the persistence on this issue! 🙏 I'm unassigning this issue since I believe this is ready for a committer review.

hash6’s picture

Thanks @lauriii for continuous support and guidance on every stage. Highly appreciated !!!

alexpott’s picture

Version: 8.9.x-dev » 8.8.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed 4b74e91fe3 to 9.0.x and 492fd1e3d0 to 8.9.x and 5a5d78365c to 8.8.x. Thanks!

Backported to 8.8.x since Claro is experimental.

diff --git a/core/themes/claro/css/components/button.pcss.css b/core/themes/claro/css/components/button.pcss.css
index 79db404e06..f1f95222bd 100644
--- a/core/themes/claro/css/components/button.pcss.css
+++ b/core/themes/claro/css/components/button.pcss.css
@@ -110,8 +110,6 @@ a.button:active {
 }
 
 /* Primary button styles */
-
-
 .button--primary {
   color: var(--button-fg-color--primary);
   background-color: var(--button-bg-color--primary);

Removed unnecessary new lines on commit.

  • alexpott committed 4b74e91 on 9.0.x
    Issue #3096831 by hash6, sd9121, lauriii, huzooka: Fix default link...

  • alexpott committed 492fd1e on 8.9.x
    Issue #3096831 by hash6, sd9121, lauriii, huzooka: Fix default link...

  • alexpott committed 5a5d783 on 8.8.x
    Issue #3096831 by hash6, sd9121, lauriii, huzooka: Fix default link...

Status: Fixed » Closed (fixed)

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