Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "fix: Combobox and Dropdown hover/active border colors and padding styles",
"packageName": "@fluentui/react-combobox",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const useStyles = makeStyles({
display: 'inline-grid',
gridTemplateColumns: '1fr auto',
justifyContent: 'space-between',
minWidth: '160px',
minWidth: '250px',
position: 'relative',

// windows high contrast mode focus indicator
Expand All @@ -45,7 +45,7 @@ const useStyles = makeStyles({
height: `max(2px, ${tokens.borderRadiusMedium})`,
borderBottomLeftRadius: tokens.borderRadiusMedium,
borderBottomRightRadius: tokens.borderRadiusMedium,
...shorthands.borderBottom('2px', 'solid', tokens.colorCompoundBrandStroke),
...shorthands.borderBottom(tokens.strokeWidthThick, 'solid', tokens.colorCompoundBrandStroke),
clipPath: 'inset(calc(100% - 2px) 0 0 0)',
transform: 'scaleX(0)',
transitionProperty: 'transform',
Expand Down Expand Up @@ -94,12 +94,22 @@ const useStyles = makeStyles({
// appearance variants
outline: {
backgroundColor: tokens.colorNeutralBackground1,
...shorthands.border('1px', 'solid', tokens.colorNeutralStroke1),
...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke1),
borderBottomColor: tokens.colorNeutralStrokeAccessible,

'&:hover': {
...shorthands.borderColor(tokens.colorNeutralStroke1Hover),
borderBottomColor: tokens.colorNeutralStrokeAccessible,
},

'&:active': {
...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),
borderBottomColor: tokens.colorNeutralStrokeAccessible,
},
},
underline: {
backgroundColor: tokens.colorTransparentBackground,
...shorthands.borderBottom('1px', 'solid', tokens.colorNeutralStrokeAccessible),
...shorthands.borderBottom(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStrokeAccessible),
...shorthands.borderRadius(0),
},
'filled-lighter': {
Expand Down Expand Up @@ -130,17 +140,17 @@ const useInputStyles = makeStyles({
small: {
fontSize: tokens.fontSizeBase200,
lineHeight: tokens.lineHeightBase200,
...shorthands.padding('3px', 0, '3px', tokens.spacingHorizontalSNudge),
...shorthands.padding('3px', 0, '3px', `calc(${tokens.spacingHorizontalSNudge} + ${tokens.spacingHorizontalXXS})`),
},
medium: {
fontSize: tokens.fontSizeBase300,
lineHeight: tokens.lineHeightBase300,
...shorthands.padding('5px', 0, '5px', tokens.spacingHorizontalMNudge),
...shorthands.padding('5px', 0, '5px', `calc(${tokens.spacingHorizontalMNudge} + ${tokens.spacingHorizontalXXS})`),
},
large: {
fontSize: tokens.fontSizeBase400,
lineHeight: tokens.lineHeightBase400,
...shorthands.padding('7px', 0, '7px', tokens.spacingHorizontalM),
...shorthands.padding('7px', 0, '7px', `calc(${tokens.spacingHorizontalM} + ${tokens.spacingHorizontalSNudge})`),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason why this padding is horizontalM and HorizontalSNudge? Do we need a new token to define these new widths? Or maybe we need a comment to explain why these calculations are happening.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we talked a while ago about using calc instead of adding an extra node within Dropdown to wrap the text, which would be the other option.

For combobox, it's pretty much just necessary, since <input>s can't have children

},
});

Expand All @@ -161,12 +171,15 @@ const useIconStyles = makeStyles({
// icon size variants
small: {
fontSize: iconSizes.small,
marginLeft: tokens.spacingHorizontalXXS,
},
medium: {
fontSize: iconSizes.medium,
marginLeft: tokens.spacingHorizontalXXS,
},
large: {
fontSize: iconSizes.large,
marginLeft: tokens.spacingHorizontalSNudge,
},
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const useStyles = makeStyles({
...shorthands.borderRadius(tokens.borderRadiusMedium),
boxSizing: 'border-box',
display: 'inline-block',
minWidth: '160px',
minWidth: '250px',
position: 'relative',

// windows high contrast mode focus indicator
Expand All @@ -38,10 +38,10 @@ const useStyles = makeStyles({
left: '-1px',
bottom: '-1px',
right: '-1px',
height: `max(2px, ${tokens.borderRadiusMedium})`,
height: `max(${tokens.strokeWidthThick}, ${tokens.borderRadiusMedium})`,
borderBottomLeftRadius: tokens.borderRadiusMedium,
borderBottomRightRadius: tokens.borderRadiusMedium,
...shorthands.borderBottom('2px', 'solid', tokens.colorCompoundBrandStroke),
...shorthands.borderBottom(tokens.strokeWidthThick, 'solid', tokens.colorCompoundBrandStroke),
clipPath: 'inset(calc(100% - 2px) 0 0 0)',
transform: 'scaleX(0)',
transitionProperty: 'transform',
Expand Down Expand Up @@ -77,6 +77,7 @@ const useStyles = makeStyles({
...shorthands.border('0'),
boxSizing: 'border-box',
columnGap: tokens.spacingHorizontalXXS,
cursor: 'pointer',
display: 'grid',
fontFamily: tokens.fontFamilyBase,
gridTemplateColumns: '1fr auto',
Expand All @@ -97,29 +98,54 @@ const useStyles = makeStyles({
small: {
fontSize: tokens.fontSizeBase200,
lineHeight: tokens.lineHeightBase200,
...shorthands.padding('3px', tokens.spacingHorizontalSNudge),
...shorthands.padding(
'3px',
tokens.spacingHorizontalSNudge,
'3px',
`calc(${tokens.spacingHorizontalSNudge} + ${tokens.spacingHorizontalXXS})`,
),
},
medium: {
fontSize: tokens.fontSizeBase300,
lineHeight: tokens.lineHeightBase300,
...shorthands.padding('5px', tokens.spacingHorizontalMNudge),
...shorthands.padding(
'5px',
tokens.spacingHorizontalMNudge,
'5px',
`calc(${tokens.spacingHorizontalMNudge} + ${tokens.spacingHorizontalXXS})`,
),
},
large: {
columnGap: tokens.spacingHorizontalSNudge,
fontSize: tokens.fontSizeBase400,
lineHeight: tokens.lineHeightBase400,
...shorthands.padding('7px', tokens.spacingHorizontalM),
...shorthands.padding(
'7px',
tokens.spacingHorizontalM,
'7px',
`calc(${tokens.spacingHorizontalM} + ${tokens.spacingHorizontalSNudge})`,
),
},

// appearance variants
outline: {
backgroundColor: tokens.colorNeutralBackground1,
...shorthands.border('1px', 'solid', tokens.colorNeutralStroke1),
...shorthands.border(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStroke1),
borderBottomColor: tokens.colorNeutralStrokeAccessible,

'&:hover': {
...shorthands.borderColor(tokens.colorNeutralStroke1Hover),
borderBottomColor: tokens.colorNeutralStrokeAccessible,
},

'&:active': {
...shorthands.borderColor(tokens.colorNeutralStroke1Pressed),
borderBottomColor: tokens.colorNeutralStrokeAccessible,
},
},
underline: {
backgroundColor: tokens.colorTransparentBackground,
...shorthands.borderBottom('1px', 'solid', tokens.colorNeutralStrokeAccessible),
...shorthands.borderBottom(tokens.strokeWidthThin, 'solid', tokens.colorNeutralStrokeAccessible),
...shorthands.borderRadius(0),
},
'filled-lighter': {
Expand Down Expand Up @@ -147,12 +173,15 @@ const useIconStyles = makeStyles({
// icon size variants
small: {
fontSize: iconSizes.small,
marginLeft: tokens.spacingHorizontalXXS,
},
medium: {
fontSize: iconSizes.medium,
marginLeft: tokens.spacingHorizontalXXS,
},
large: {
fontSize: iconSizes.large,
marginLeft: tokens.spacingHorizontalSNudge,
},
});

Expand Down