Skip to content

Commit

Permalink
fix(field): adjust outline-offset instead of padding and margin
Browse files Browse the repository at this point in the history
  • Loading branch information
samrichardsontylertech committed Oct 11, 2024
1 parent d4bb765 commit 3ab5cda
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/lib/field/_core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
outline-style: #{token(outline-style)};
outline-width: #{token(outline-width)};
outline-color: #{token(outline-color, custom)};
outline-offset: calc(#{token(outline-width)} * -1);
pointer-events: none;
}

Expand Down
6 changes: 0 additions & 6 deletions src/lib/field/_core.theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,13 @@ $elevations: (
@include override(padding-inline, 0, value);
@include override(surface-display, none, value);
} @else if $variant == outlined {
@include with-outline;
@include hidden-background;
} @else if $variant == tonal {
@include no-outline;
@include unoutlined-variant-inner-border;
@include visible-background(tonal);
@include override(multiline-inset-label-background, #{token(multiline-inset-label-tonal-background, custom)}, value);
} @else if $variant == filled {
@include with-outline;
@include visible-background(filled);
} @else if $variant == raised {
@include elevated;
Expand All @@ -125,10 +123,6 @@ $elevations: (
}
}

@mixin with-outline {
padding: #{token(outline-width)};
}

@mixin no-outline($no-inner: false) {
@include override(outline-color, transparent, value);
@include override(outline-color-hover, transparent, value);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/field/field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ forge-focus-indicator {
@include focus-indicator.provide-theme(
(
color: #{token(focus-indicator-color, custom)},
outward-offset: 0px,
outward-offset: calc(#{token(outline-width)} * -1),
shape: #{token(shape)},
width: #{token(focus-indicator-width)}
)
Expand Down
5 changes: 3 additions & 2 deletions src/lib/field/forge-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ $_input-selector: ':where(input, textarea, select, .forge-field__input)';

box-shadow: #{token(elevation, custom)};

margin: #{token(outline-width)};
padding-inline: #{token(padding-inline)};
border-radius: #{token(shape)};
outline-style: #{token(outline-style)};
outline-width: #{token(outline-width)};
outline-color: #{theme.variable(outline-low)};
outline-offset: calc(#{token(outline-width)} * -1);

background: #{token(background)};

Expand Down Expand Up @@ -328,7 +328,8 @@ $_input-selector: ':where(input, textarea, select, .forge-field__input)';
&.forge-field:has(#{$_input-selector}:focus) {
@include focus-indicator.provide-theme(
(
color: #{theme.variable(error)}
color: #{theme.variable(error)},
outward-offset: calc(#{token(outline-width)} * -1)
)
);
}
Expand Down

0 comments on commit 3ab5cda

Please sign in to comment.