Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 066d943

Browse files
joyzhongcopybara-github
authored andcommitted
refactor(focus): Set focus ring inward defaults to avoid duplication in caller components.
PiperOrigin-RevId: 509893762
1 parent 6fcd8d4 commit 066d943

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

packages/mdc-focus/_focus-ring-inward-theme.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ $_ring-extra-offset-bottom-key: 'extra-offset-bottom';
1414
$default-inward-theme: map.merge(
1515
focus-ring-shared-theme.$default-shared-theme,
1616
(
17+
focus-ring-shared-theme.$ring-offset-key: -1 * focus-ring-shared-theme.$track-width-value,
18+
focus-ring-shared-theme.$target-shape-key: 8px,
1719
// Extra offset to bottom of focus ring in addition to default ring offset
18-
$_ring-extra-offset-bottom-key: 0px
20+
$_ring-extra-offset-bottom-key: 0px,
1921
)
2022
);
2123

packages/mdc-focus/_focus-ring-outward-theme.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
$_custom-property-prefix: 'focus-ring-outward';
1212

1313
$default-outward-theme: focus-ring-shared-theme.$default-shared-theme;
14+
$default-outward-theme: map.merge(
15+
focus-ring-shared-theme.$default-shared-theme,
16+
(
17+
focus-ring-shared-theme.$ring-offset-key: 2px,
18+
focus-ring-shared-theme.$target-shape-key: 0px,
19+
)
20+
);
1421

1522
/// Generates CSS custom properties that are consumed by the focus ring styles.
1623
/// Intended to be used directly by Material Design customers, as the only

packages/mdc-focus/_focus-ring-shared-theme.scss

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@ $ring-offset-key: 'offset';
66
$ring-color-key: 'color';
77
$track-width-key: 'track-width';
88
$target-shape-key: 'target-shape';
9+
$track-width-value: 3px;
910
$_grow-animation-duration: 150ms;
1011
$_shrink-animation-duration: 450ms;
1112
$_animation-timing: cubic-bezier(0.2, 0, 0, 1);
1213

1314
$_color-sys: tokens.md-sys-color-values-light();
1415

1516
$default-shared-theme: (
16-
$ring-offset-key: 2px,
17-
$track-width-key: 3px,
18-
$ring-color-key: map.get($_color-sys, secondary),
19-
$target-shape-key: 0px,
17+
$track-width-key: $track-width-value,
18+
$ring-color-key: map.get($_color-sys, 'secondary'),
2019
);
2120

2221
@mixin focus-ring-animation($grow-animation-name, $shrink-animation-name) {

0 commit comments

Comments
 (0)