Problem/Motivation
Now we have <button> elements and <a> looking as buttons, which is a bad pattern in several ways. But we have some links that need special attention because they should be more descriptive about where they will take you to. More info in this discussion on the previous Github repo issue for buttons.
Proposed resolution
Implement a new component calledAction link to differentiate them from regular links.
Specification
Quick overview
This image is just a quick overview for Horizontal tabs specs. Please use the Figma link to full specification as the main resource for specks.

Full specification
FIGMA: https://www.figma.com/file/OqWgzAluHtsOd5uwm1lubFeH/Drupal-Design-system...
This link is anchored to the board with the full specification. As an anonymous user you can see the design, but to actually be able to pick colours and sizes please login to Figma.
Remaining tasks
- Plan which elements will use this component
- Update patch
- Accessibility review
- RTL review (Right to left)
User interface changes
Some anchors previously styled as buttons will be action links now.
Test Pages
- /node/add/article
| Comment | File | Size | Author |
|---|---|---|---|
| #43 | interdiff-3036732-40-43.txt | 7.24 KB | huzooka |
| #43 | claro-action_link_component-3036732-43.patch | 36.54 KB | huzooka |
| #40 | interdiff-3036732-35-40.txt | 14.01 KB | huzooka |
| #40 | claro-action_link-3036732-40.patch | 37.65 KB | huzooka |
| #37 | actionLinkScreenshots--high-contrast.zip | 1.76 MB | huzooka |
Comments
Comment #2
ckrinaComment #3
huzookaAttached the separated patch from #3021087: Buttons#82
Comment #4
kostyashupenkoAdded patch with realisation of `action-link` component.
Added also "delete" variation of `action-link` component.
So default markup and screen:

<a href="/" class="action-link">Test link</a>Delete variation markup and screen:

<a href="/" class="action-link action-link--delete">Delete</a>Also this component linked to node/#/edit delete link

Comment #5
ckrinaThanks @kostyashupenko! I've just done a quick review and I'd suggest to tie the red to the danger variation, but not the icon. Thinking on reusing the icons independently of its color, I'd say each icon should be a variation itself. So the delete action would have
.action-link--dangerandaction-link--trashfor example.Comment #6
ant1Comment #7
ant1Split up
.action-link--delete(color) and.action-link--trash(icon).When both classes are applied on the Action Link, change the color of the trash icon to red.
Comment #8
ant1Forgot to change
.action-link--deleteto.action-link--danger.Done in this patch.
Comment #9
fhaeberleI reviewed this and the patch provided in #8 looks really good already.
I found two trifles:
The current delete link looks a bit smaller because of the missing box shadow, that's not even bad but I want to mention it here.
This comment can be moved before/outside the selector.
Comment #10
huzookaComment #11
huzookaFixed #9.2, and besides that:
What happened:
action-link--trashchanged toaction-link--icon-trash._claro_convert_link_to_action_link((). That's where most of the magic happens.Some background: previously, @lauriii, @ckrina and I agreed that we need to implement the variation with the trash icon and the variations that are (or will be) used on the Appearance form page.
Think that are still missing:
Think that are a bit weird:
Actually, these action-links are now a separately-themed buttons with a white background and with an icon:
I'm setting this to Needs review only for testing this patch.
Comment #12
huzookaComment #13
lauriiiFor anyone interested in working on this, it seems like interdiff and actual patch are mixed in #11.
Comment #14
huzookaComment #15
huzookaRe #13: Actually I completely missed adding the main part of the action link component modifications.
Here is the updated patch with high contrast related improvements, so the only remaining task is generating the screenshots.
Comment #16
lauriiiI think we should remove the icon from the default variation and make it it's own variation instead.
Any thoughts on returning a new link instead of editing a referenced link? It seems better for readability and more versatile.
Should we rename this to action-link.css to be more consistent?
Comment #17
huzookaComment #18
huzookaAddressing #16.
Comment #19
lauriiiWe have to replace the original link with the action link now that we are not changing it as a reference.
According to the design system, the left padding should be 0.75rem.
What is this comment referencing to?
We should remove default from the comment.
👍
Comment #20
huzookaComment #21
lauriii#19.2 is still not solved by #20.
Comment #22
huzookaRe #21: You're wrong. It is resolved.
Comment #23
huzookaComment #24
lauriiiSorry, that was my mistake. I looked at the patch too quickly and didn't notice the change.
Any thoughts on using
filterinstead of replacing the background image? I used this approach on #3023301: Messages style update. This allows us to get rid of the !important and allows us to have one less variation of the icons.The margins should be still update to match with the design system.
Comment #25
katriencPatch #20 gives wrong padding on .action-link (like mentioned in #19.2)
On the screenshot I focused the button elements so you could see the wrong padding.
The padding on action-link class should be the same as the button class. Which now is
calc(1rem - 1px) calc(1.5rem - 1px)I've changed this
Comment #26
huzookaComment #27
huzookaAdding the missing interdiff between #20 and #25.
Comment #28
huzookaComment #29
huzookaThis patch fixes #24.2 and #25.
Re #24:
Re #25:
The pseudo has 1rem height while the font's (ascender height + the descender height) was 1rem. I increased the
line-heightof action-links and decreased their vertical padding.Comment #30
lauriiiAccording to the design system, the margin between buttons should be 12px, but the margin between a button and action link should be 8px 🤠
Comment #31
lauriiiHere's screenshots of the spec:

Comment #32
huzookaComment #33
huzookaComment #34
huzookaComment #35
huzookaThis patch applies the most recent design changes for action-links and buttons.
Comment #36
ckrinaWe've been discussing with @lauriii a way to make Action Links implementation easier and we've come up with the solution to avoid having a smaller space between Action Links than the one between Buttons. So for M button&Action Links it'll be a 12px spacing, while for S Action Links and S/XS buttons 8px of horizontal spacing:
Comment #37
huzookaSrceenshots attached.
Comment #38
lauriiiInstead of using !important, maybe we should use the duplicate selector trick to increase the weight of this selector.
I can't find where it is mentioned that this is specific to form actions.
Should we document which icons are available or where to find a list of available icons?
It doesn't seem like
Drupal\Core\Render\Element\Link::preRenderLinkis using the deep merge. I'm wondering if this difference could lead to unwanted changes in behavior 🤔Nit: there's double space between of and URL.
Nit: s/form's/forms
Comment #39
huzookaComment #40
huzookaThis addresses everything from #38 hopefully.
Comment #41
lauriiiThis seems a bit overkill to me. I'd just keep the $variant parameter and let that define the variation. Or do we have a specific use case in mind where it couldn't be used?
This is fine, but it might be clearer to just duplicate the same class name because it makes it obvious that it's used for increasing the weight, not to increase the specificity.
Comment #42
huzookaComment #43
huzookaAddressing #41.
Comment #45
lauriiiLooks great! Good job everyone! 👏
Comment #46
lauriiiSaving issue credits