Skip to content

Commit

Permalink
FormTokenField: Fix token styles (#66640)
Browse files Browse the repository at this point in the history
* FormTokenField: Fix token styles

* Add changelog

Co-authored-by: mirka <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored Nov 1, 2024
1 parent d2157ff commit 49c3bf9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- `Guide`: Use small size button for page controls ([#66607](https://github.com/WordPress/gutenberg/pull/66607)).
- `PaletteEdit`: Add appropriate size props to Buttons ([#66590](https://github.com/WordPress/gutenberg/pull/66590)).
- `Notice`: Add appropriate size props to Buttons ([#66593](https://github.com/WordPress/gutenberg/pull/66593)).
- `FormTokenField`: Fix token styles ([#66640](https://github.com/WordPress/gutenberg/pull/66640)).

### Internal

Expand Down
20 changes: 8 additions & 12 deletions packages/components/src/form-token-field/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,12 @@

.components-form-token-field__token-text {
background: transparent;
color: $components-color-accent;
}

&:not(.is-disabled) {
.components-form-token-field__token-text {
color: $components-color-accent;
}
}

.components-form-token-field__remove-token {
Expand All @@ -90,7 +95,6 @@
position: absolute;
top: 1px;
right: 0;
padding: 0;
}

&.is-success {
Expand All @@ -112,18 +116,11 @@
}
}
}

&.is-disabled {
.components-form-token-field__remove-token {
cursor: default;
}
}
}

.components-form-token-field__token-text,
.components-form-token-field__remove-token.components-button {
display: inline-block;
line-height: 24px;
height: auto;
background: $gray-300;
min-width: unset;
Expand All @@ -134,20 +131,19 @@
.components-form-token-field__token-text {
border-radius: $radius-x-small 0 0 $radius-x-small;
padding: 0 0 0 8px;
line-height: 24px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}

.components-form-token-field__remove-token.components-button {
cursor: pointer;
border-radius: 0 $radius-x-small $radius-x-small 0;
padding: 0 2px;
color: $gray-900;
line-height: 10px;
overflow: initial;

&:hover {
&:hover:not(:disabled) {
color: $gray-900;
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/form-token-field/token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default function Token( {

<Button
className="components-form-token-field__remove-token"
size="small"
icon={ closeSmall }
onClick={ ! disabled ? onClick : undefined }
// Disable reason: Even when FormTokenField itself is accessibly disabled, token reset buttons shouldn't be in the tab sequence.
Expand Down

0 comments on commit 49c3bf9

Please sign in to comment.