Skip to content

Commit 345c318

Browse files
jcfrancobenelan
authored andcommitted
fix(link): fix underline animation (#10835)
**Related Issue:** #7284 ## Summary Restores the underline animation that was broken in v2.7.0 (#8797) and updates it to work consistently in both LTR/RTL directions. This also adds a `transition-default` mixin to provide finer-grained control of transitions.
1 parent dd0be0a commit 345c318

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

packages/calcite-components/src/assets/styles/includes.scss

+18
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,21 @@
193193
}
194194
}
195195
}
196+
197+
// we explicitly list these properties to avoid animating properties that are not intended to be animated and that might affect performance
198+
$common-animatable-props: "background-color, block-size, border-color, box-shadow, color, inset-block-end, inset-block-start, inset-inline-end, inset-inline-start, inset-size, opacity, outline-color, transform";
199+
200+
// Mixin for default component transitions with support for customization:
201+
// - Use $extra-props to add specific properties (comma-separated string).
202+
// - Use $target-props to replace the default base properties entirely (comma-separated string).
203+
@mixin transition-default($target-props: $common-animatable-props, $extra-props: null) {
204+
$merged-props: $target-props;
205+
206+
@if $extra-props != null {
207+
$merged-props: join($target-props, $extra-props, comma);
208+
}
209+
210+
transition-property: #{$merged-props};
211+
transition-duration: var(--calcite-animation-timing);
212+
transition-timing-function: ease-in-out;
213+
}

packages/calcite-components/src/components/link/link.scss

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
:host a,
1515
:host span {
1616
@apply font-inherit
17-
transition-default
1817
relative
1918
flex
2019
cursor-pointer
@@ -29,6 +28,8 @@
2928
&:hover {
3029
text-decoration: none;
3130
}
31+
32+
@include transition-default($extra-props: "background-size");
3233
}
3334

3435
// focus styles
@@ -48,7 +49,7 @@ calcite-icon {
4849
}
4950

5051
.calcite-link--icon {
51-
@apply transition-default align-middle;
52+
@apply align-middle;
5253
margin-block-start: -0.25em;
5354
}
5455

@@ -64,8 +65,7 @@ calcite-icon {
6465
:host {
6566
span,
6667
a {
67-
@apply transition-default
68-
relative
68+
@apply relative
6969
inline
7070
border-none
7171
bg-transparent

0 commit comments

Comments
 (0)