@codecademy/gamut
74.0.174.0.2-alpha.b4821a.0
dist/Form/SelectDropdown/core/styles.js~
dist/Form/SelectDropdown/core/styles.jsModified+20−5
Index: package/dist/Form/SelectDropdown/core/styles.js
===================================================================
--- package/dist/Form/SelectDropdown/core/styles.js
+++ package/dist/Form/SelectDropdown/core/styles.js
@@ -87,8 +87,14 @@
size
} = state.selectProps;
const getSize = size ?? 'medium';
const getPadding = isMulti && state.hasValue && size !== 'small' ? `mediumIsMultiSelected` : getSize;
+ const borderStateProps = {
+ isDisabled: state.isDisabled,
+ error: state.selectProps.error,
+ activated: state.selectProps.activated,
+ theme
+ };
return {
...selectDropdownStyles({
theme
}),
@@ -97,12 +103,17 @@
theme
}),
...conditionalBorderStates({
isFocused: state.isFocused,
- isDisabled: state.isDisabled,
- error: state.selectProps.error,
- activated: state.selectProps.activated,
- theme
+ ...borderStateProps
+ }),
+ /*
+ * Non-searchable: focus sits on the trigger, so react-select's isFocused stays false.
+ * Show the same focused border on the control while anything inside it has focus.
+ */
+ '&:focus-within': conditionalBorderStates({
+ isFocused: true,
+ ...borderStateProps
})
};
},
dropdownIndicator: () => ({
@@ -241,8 +252,12 @@
marginLeft: 0
}),
valueContainer: provided => ({
...provided,
- padding: 0
+ padding: 0,
+ /* The control shows focus (see `control`), so drop the browser outline on the trigger. */
+ '&:focus, &:focus-visible': {
+ outline: 'none'
+ }
})
};
};
\ No newline at end of file