Skip to content

Commit

Permalink
Dropdown: Removing unintended extra height (#20636)
Browse files Browse the repository at this point in the history
#### Pull request checklist

- [x] Addresses an existing issue: Fixes #19857
- [x] Include a change request file using `$ yarn change`

#### Description of changes

The down caret icon in `Dropdown` was specified with the height of the component but absolutely positioned as `top: 1` which actually made it 1 pixel taller than the `Dropdown` itself. This created a scrollbar in high zoom settings. This PR fixes this by specifying `paddingTop: 1` and `top: 0` so that the caret is still in the same position but the its height is not taller than that of the component itself.
  • Loading branch information
khmakoto authored Nov 17, 2021
1 parent c99f863 commit 20a59a5
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Dropdown: Removing unintended extra height.",
"packageName": "@fluentui/react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,10 @@ exports[`Component Examples renders ChoiceGroup.Custom.Example.tsx correctly 1`]
{
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,10 @@ Array [
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,10 @@ exports[`Component Examples renders Dropdown.Basic.Example.tsx correctly 1`] = `
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down Expand Up @@ -394,9 +395,10 @@ exports[`Component Examples renders Dropdown.Basic.Example.tsx correctly 1`] = `
{
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down Expand Up @@ -602,9 +604,10 @@ exports[`Component Examples renders Dropdown.Basic.Example.tsx correctly 1`] = `
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@ exports[`Component Examples renders Dropdown.Controlled.Example.tsx correctly 1`
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,10 @@ exports[`Component Examples renders Dropdown.ControlledMulti.Example.tsx correct
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,10 @@ exports[`Component Examples renders Dropdown.Custom.Example.tsx correctly 1`] =
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down Expand Up @@ -579,9 +580,10 @@ exports[`Component Examples renders Dropdown.Custom.Example.tsx correctly 1`] =
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,10 @@ exports[`Component Examples renders Dropdown.Error.Example.tsx correctly 1`] = `
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,10 @@ exports[`Component Examples renders Dropdown.Required.Example.tsx correctly 1`]
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down Expand Up @@ -551,9 +552,10 @@ exports[`Component Examples renders Dropdown.Required.Example.tsx correctly 1`]
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,10 @@ exports[`Component Examples renders Dropdown.Wrapping.Example.tsx correctly 1`]
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1088,9 +1088,10 @@ exports[`Component Examples renders Facepile.Basic.Example.tsx correctly 1`] = `
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1191,9 +1191,10 @@ exports[`Component Examples renders Facepile.Overflow.Example.tsx correctly 1`]
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4154,9 +4154,10 @@ exports[`Component Examples renders ResizeGroup.OverflowSet.Example.tsx correctl
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down
7 changes: 4 additions & 3 deletions packages/react/src/components/Dropdown/Dropdown.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,12 @@ export const getStyles: IStyleFunction<IDropdownStyleProps, IDropdownStyles> = p
caretDownWrapper: [
globalClassnames.caretDownWrapper,
{
position: 'absolute',
top: 1,
right: 8,
height: DROPDOWN_HEIGHT,
lineHeight: DROPDOWN_HEIGHT - 2, // height minus the border
paddingTop: 1,
position: 'absolute',
right: 8,
top: 0,
},
!disabled && {
cursor: 'pointer',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ exports[`Dropdown multi-select Renders correctly 1`] = `
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down Expand Up @@ -318,9 +319,10 @@ exports[`Dropdown multi-select Renders correctly when open 1`] = `
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down Expand Up @@ -1160,9 +1162,10 @@ exports[`Dropdown single-select Renders correctly 1`] = `
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down Expand Up @@ -1333,9 +1336,10 @@ exports[`Dropdown single-select Renders correctly when open 1`] = `
cursor: pointer;
height: 32px;
line-height: 30px;
padding-top: 1px;
position: absolute;
right: 8px;
top: 1px;
top: 0px;
}
>
<i
Expand Down

0 comments on commit 20a59a5

Please sign in to comment.