Skip to content
Open
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 1 addition & 7 deletions src/select.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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
},
},
]);

Expand Down
1 change: 1 addition & 0 deletions src/text-field-base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ export const TextFieldBase = React.forwardRef<any, TextFieldBaseProps>(
fieldRef={fieldRef}
readOnly={rest.readOnly}
dataAttributes={dataAttributes}
focus={focus}
>
<ThemeVariant variant="default">
{startIcon && (
Expand Down
4 changes: 4 additions & 0 deletions src/text-field-components.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion src/text-field-components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ type FieldContainerProps = {
fullWidth?: boolean;
readOnly?: boolean;
dataAttributes?: DataAttributes;
focus?: boolean;
};

export const FieldContainer = ({
Expand All @@ -191,6 +192,7 @@ export const FieldContainer = ({
fullWidth,
readOnly,
dataAttributes,
focus,
}: FieldContainerProps): JSX.Element => {
const cssVarStyles = useApplyCssVars();
return (
Expand All @@ -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}
>
Expand Down
Loading