Skip to content

Commit

Permalink
Resolves #5888 (#5889)
Browse files Browse the repository at this point in the history
  • Loading branch information
zaquille-oneil committed May 26, 2022
1 parent 87b4890 commit fe89879
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .changeset/strange-scissors-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': patch
---

Fixed clear button covering placeholder text in `TextField` on small screens
4 changes: 0 additions & 4 deletions polaris-react/src/components/TextField/TextField.scss
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,6 @@ $spinner-icon-size: 12px;
}
}

.Hidden {
visibility: hidden;
}

.Spinner {
--pc-text-field-spinner-offset-large: calc(
var(--p-text-field-spinner-offset) + var(--p-border-width-1)
Expand Down
30 changes: 14 additions & 16 deletions polaris-react/src/components/TextField/TextField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -327,22 +327,20 @@ export function TextField({

const clearButtonVisible = normalizedValue !== '';

const clearButtonClassNames = classNames(
styles.ClearButton,
!clearButtonVisible && styles.Hidden,
);

const clearButtonMarkup = clearButton ? (
<button
type="button"
className={clearButtonClassNames}
onClick={handleClearButtonPress}
disabled={disabled}
>
<VisuallyHidden>{i18n.translate('Polaris.Common.clear')}</VisuallyHidden>
<Icon source={CircleCancelMinor} color="base" />
</button>
) : null;
const clearButtonMarkup =
clearButton && clearButtonVisible ? (
<button
type="button"
className={styles.ClearButton}
onClick={handleClearButtonPress}
disabled={disabled}
>
<VisuallyHidden>
{i18n.translate('Polaris.Common.clear')}
</VisuallyHidden>
<Icon source={CircleCancelMinor} color="base" />
</button>
) : null;

const handleNumberChange = useCallback(
(steps: number) => {
Expand Down

0 comments on commit fe89879

Please sign in to comment.