Skip to content

refactor(button): remove spectrum-ButtonWithFocusRing extend #2725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/fresh-seahorses-join.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@spectrum-css/button": patch
---

#### refactor: remove spectrum-ButtonWithFocusRing placeholder class extend

Removes the need for the extend from this placeholder class, as the styles it provides have diverged slightly from what is in button and it was causing some unnecessary CSS to override.
This should not result in any changed visuals or behavior, as the same CSS has been integrated.
11 changes: 2 additions & 9 deletions components/button/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ governing permissions and limitations under the License.

.spectrum-Button {
@extend %spectrum-BaseButton;
@extend %spectrum-ButtonWithFocusRing;

border-radius: var(--mod-button-border-radius, var(--spectrum-button-border-radius));
border-width: var(--mod-button-border-width, var(--spectrum-button-border-width));
Expand Down Expand Up @@ -384,6 +383,8 @@ governing permissions and limitations under the License.

/* Focus indicator */
&::after {
content: "";
display: block;
position: absolute;
inset: 0;
margin: calc((
Expand All @@ -397,7 +398,6 @@ governing permissions and limitations under the License.
));
transition: box-shadow var(--mod-button-animation-duration, var(--spectrum-button-animation-duration)) ease-in-out;
pointer-events: none;
content: '';
}

&:focus-visible,
Expand All @@ -409,13 +409,6 @@ governing permissions and limitations under the License.
box-shadow: 0 0 0
var(--mod-button-focus-ring-thickness, var(--spectrum-button-focus-ring-thickness))
var(--highcontrast-button-focus-ring-color, var(--mod-button-focus-ring-color, var(--spectrum-button-focus-indicator-color)));

/* Margin is repeated to override declaration coming from the imported BaseButton. */
margin: calc((
var(--mod-button-focus-ring-gap, var(--spectrum-button-focus-ring-gap)) +
var(--mod-button-border-width, var(--spectrum-button-border-width))
) * -1
);
}
}

Expand Down
1 change: 0 additions & 1 deletion components/button/metadata/mods.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
| `--mod-button-edge-to-text` |
| `--mod-button-edge-to-visual` |
| `--mod-button-edge-to-visual-only` |
| `--mod-button-focus-indicator-gap` |
| `--mod-button-focus-ring-border-radius` |
| `--mod-button-focus-ring-color` |
| `--mod-button-focus-ring-gap` |
Expand Down
Loading