Skip to content

Commit 8f95207

Browse files
spectrum-Search-icon should be pushed down into TextFieldBase (#1685)
* Fix to use spectrum-Textfield-icon instaed of spectrum-Search-icon * Delete UNSAFE_className * small adjustment to left position of the icon which drifted too far to the start edge * Update to match padding from spectrum-css We need to check in with design on this before we can merge it * fix start padding to rely on textfield Co-authored-by: Rob Snow <rsnow@adobe.com>
1 parent 8cd1214 commit 8f95207

File tree

5 files changed

+9
-68
lines changed

5 files changed

+9
-68
lines changed

packages/@adobe/spectrum-css-temp/components/search/index.css

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ governing permissions and limitations under the License.
7070
/* Correct the outline for input[type="search"] style in Safari. */
7171
outline-offset: -2px;
7272

73-
/* Use padding instead of text-indent so long strings don't overlap the icon */
74-
padding-inline-start: var(--spectrum-search-padding-left);
7573
text-indent: 0;
7674

7775
/* Don't let long strings overlap the close icon */
@@ -96,16 +94,3 @@ governing permissions and limitations under the License.
9694
}
9795
}
9896

99-
/* Positions search magnifier UI icon */
100-
.spectrum-Search .spectrum-Search-icon {
101-
display: block;
102-
position: absolute;
103-
height: var(--spectrum-global-dimension-size-200);
104-
width: var(--spectrum-global-dimension-size-200);
105-
inset-inline-start: 12px;
106-
top: calc(calc(var(--spectrum-textfield-height) / 2) - calc(var(--spectrum-global-dimension-size-200) / 2));
107-
108-
transition: fill var(--spectrum-global-animation-duration-100) ease-in-out;
109-
110-
pointer-events: none;
111-
}

packages/@adobe/spectrum-css-temp/components/search/skin.css

Lines changed: 0 additions & 42 deletions
This file was deleted.

packages/@adobe/spectrum-css-temp/components/search/vars.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@
1111
*/
1212

1313
@import './index.css';
14-
@import './skin.css';

packages/@adobe/spectrum-css-temp/components/textfield/index.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,21 @@ governing permissions and limitations under the License.
227227
position: absolute;
228228
height: var(--spectrum-icon-info-medium-height);
229229
width: var(--spectrum-icon-info-medium-width);
230-
inset-inline-start: var(--spectrum-global-dimension-size-100);
230+
/* This has a named variable in a future update of spectrum-css. */
231+
inset-inline-start: var(--spectrum-global-dimension-size-150);
231232
top: var(--spectrum-global-dimension-size-85);
232233
transition: fill var(--spectrum-global-animation-duration-100) ease-in-out;
233234
}
234235

235236
/* styles the textfield properly if the left icon is provided */
236237
.spectrum-Textfield-inputIcon {
237238
/* Use padding instead of text-indent so long strings don't overlap the icon */
238-
padding-inline-start: calc(calc(var(--spectrum-global-dimension-size-200) + var(--spectrum-icon-info-medium-width)) - 1px);
239+
/* These values have real names in a spectrum-css update, when we update, use those. */
240+
padding-inline-start: calc(
241+
var(--spectrum-global-dimension-size-150) +
242+
var(--spectrum-global-dimension-size-225) +
243+
var(--spectrum-global-dimension-size-65)
244+
);
239245

240246
.spectrum-Textfield--quiet & {
241247
padding-inline-start: calc(var(--spectrum-global-dimension-size-100) + var(--spectrum-icon-info-medium-width));

packages/@react-spectrum/searchfield/src/SearchField.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,7 @@ import {useSearchFieldState} from '@react-stately/searchfield';
2525
function SearchField(props: SpectrumSearchFieldProps, ref: RefObject<TextFieldRef>) {
2626
props = useProviderProps(props);
2727
let defaultIcon = (
28-
<Magnifier
29-
data-testid="searchicon"
30-
UNSAFE_className={
31-
classNames(
32-
styles,
33-
'spectrum-Search-icon'
34-
)
35-
} />
28+
<Magnifier data-testid="searchicon" />
3629
);
3730

3831
let {

0 commit comments

Comments
 (0)