diff --git a/src/__screenshot_tests__/__image_snapshots__/dialog-screenshot-test-tsx-select-options-are-correctly-positioned-inside-a-dialog-1-snap.png b/src/__screenshot_tests__/__image_snapshots__/dialog-screenshot-test-tsx-select-options-are-correctly-positioned-inside-a-dialog-1-snap.png index a6f49603f0..6301d36309 100644 Binary files a/src/__screenshot_tests__/__image_snapshots__/dialog-screenshot-test-tsx-select-options-are-correctly-positioned-inside-a-dialog-1-snap.png and b/src/__screenshot_tests__/__image_snapshots__/dialog-screenshot-test-tsx-select-options-are-correctly-positioned-inside-a-dialog-1-snap.png differ diff --git a/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-appears-properly-with-long-selected-option-on-desktop-1-snap.png b/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-appears-properly-with-long-selected-option-on-desktop-1-snap.png index 44abc3d081..511076b56e 100644 Binary files a/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-appears-properly-with-long-selected-option-on-desktop-1-snap.png and b/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-appears-properly-with-long-selected-option-on-desktop-1-snap.png differ diff --git a/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-appears-properly-with-selected-option-on-desktop-1-snap.png b/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-appears-properly-with-selected-option-on-desktop-1-snap.png index 980de6b022..f11dedf15e 100644 Binary files a/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-appears-properly-with-selected-option-on-desktop-1-snap.png and b/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-appears-properly-with-selected-option-on-desktop-1-snap.png differ diff --git a/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-display-all-options-1-snap.png b/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-display-all-options-1-snap.png index fd886d43d0..813948c559 100644 Binary files a/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-display-all-options-1-snap.png and b/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-display-all-options-1-snap.png differ diff --git a/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-display-all-options-in-dark-mode-1-snap.png b/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-display-all-options-in-dark-mode-1-snap.png index 009ab8a951..1c9ccd8fdc 100644 Binary files a/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-display-all-options-in-dark-mode-1-snap.png and b/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-display-all-options-in-dark-mode-1-snap.png differ diff --git a/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-display-all-options-over-inverse-1-snap.png b/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-display-all-options-over-inverse-1-snap.png index a9a144fbe1..feda9e1bce 100644 Binary files a/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-display-all-options-over-inverse-1-snap.png and b/src/__screenshot_tests__/__image_snapshots__/form-select-screenshot-test-tsx-select-display-all-options-over-inverse-1-snap.png differ diff --git a/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-14-snap.png b/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-14-snap.png index 0209103f4e..a1d22a6abb 100644 Binary files a/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-14-snap.png and b/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-14-snap.png differ diff --git a/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-15-snap.png b/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-15-snap.png index af29d58830..b1d0e2055a 100644 Binary files a/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-15-snap.png and b/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-15-snap.png differ diff --git a/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-4-snap.png b/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-4-snap.png index bce4bc1dd3..2db2143606 100644 Binary files a/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-4-snap.png and b/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-4-snap.png differ diff --git a/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-5-snap.png b/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-5-snap.png index 33d222bd26..822a7c6ec6 100644 Binary files a/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-5-snap.png and b/src/__screenshot_tests__/__image_snapshots__/private-components-in-portals-screenshot-test-tsx-components-with-portals-render-properly-desktop-5-snap.png differ diff --git a/src/select.css.ts b/src/select.css.ts index 9a29e2946c..41b8000fed 100644 --- a/src/select.css.ts +++ b/src/select.css.ts @@ -10,7 +10,6 @@ import { iconButtonSize, } from './text-field-base.css'; import {pxToRem} from './utils/css'; -import {browserDefaultFocusOutline} from './text-field-components.css'; const top = createVar(); const left = createVar(); @@ -67,17 +66,12 @@ const selectContainerBase = style([ cursor: 'pointer', }), { - borderRadius: `calc(${skinVars.borderRadii.input} - 1px)`, + outline: 'none', '@media': { [mq.tabletOrSmaller]: { width: '100%', }, }, - ':focus': { - outline: browserDefaultFocusOutline, - border: `1px solid transparent`, // needed for outline to follow border radius in Safari - margin: -1, // to avoid layout shift when adding the transparent border - }, }, ]); diff --git a/src/text-field-base.tsx b/src/text-field-base.tsx index c07074d79d..ce75a29344 100644 --- a/src/text-field-base.tsx +++ b/src/text-field-base.tsx @@ -353,6 +353,7 @@ export const TextFieldBase = React.forwardRef( fieldRef={fieldRef} readOnly={rest.readOnly} dataAttributes={dataAttributes} + focus={focus} > {startIcon && ( diff --git a/src/text-field-components.css.ts b/src/text-field-components.css.ts index 25dd3827a4..0842b3b47a 100644 --- a/src/text-field-components.css.ts +++ b/src/text-field-components.css.ts @@ -97,6 +97,10 @@ export const browserDefaultFocusOutline = [ '5px auto -webkit-focus-ring-color', // Chrome / Safari ]; +export const focused = style({ + outline: browserDefaultFocusOutline, +}); + export const fieldFocusRing = style({ ':focus-within': { outline: browserDefaultFocusOutline, diff --git a/src/text-field-components.tsx b/src/text-field-components.tsx index f1e7dda866..6c20cc87b5 100644 --- a/src/text-field-components.tsx +++ b/src/text-field-components.tsx @@ -179,6 +179,7 @@ type FieldContainerProps = { fullWidth?: boolean; readOnly?: boolean; dataAttributes?: DataAttributes; + focus?: boolean; }; export const FieldContainer = ({ @@ -191,6 +192,7 @@ export const FieldContainer = ({ fullWidth, readOnly, dataAttributes, + focus, }: FieldContainerProps): JSX.Element => { const cssVarStyles = useApplyCssVars(); return ( @@ -210,7 +212,8 @@ export const FieldContainer = ({ className={classnames( styles.field, readOnly ? styles.background.readOnly : styles.background.default, - className + className, + focus && styles.focused )} ref={fieldRef} >