From 20a59a53b4a579295d98f43265ad4918e36aa74a Mon Sep 17 00:00:00 2001 From: Makoto Morimoto Date: Wed, 17 Nov 2021 10:30:20 -0800 Subject: [PATCH] Dropdown: Removing unintended extra height (#20636) #### 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. --- ...i-react-ddb34d7a-c047-4443-a0cd-2eda22ec6308.json | 7 +++++++ .../ChoiceGroup.Custom.Example.tsx.shot | 3 ++- .../DetailsList.CustomGroupHeaders.Example.tsx.shot | 3 ++- .../__snapshots__/Dropdown.Basic.Example.tsx.shot | 9 ++++++--- .../Dropdown.Controlled.Example.tsx.shot | 3 ++- .../Dropdown.ControlledMulti.Example.tsx.shot | 3 ++- .../__snapshots__/Dropdown.Custom.Example.tsx.shot | 6 ++++-- .../__snapshots__/Dropdown.Error.Example.tsx.shot | 3 ++- .../__snapshots__/Dropdown.Required.Example.tsx.shot | 6 ++++-- .../__snapshots__/Dropdown.Wrapping.Example.tsx.shot | 3 ++- .../__snapshots__/Facepile.Basic.Example.tsx.shot | 3 ++- .../__snapshots__/Facepile.Overflow.Example.tsx.shot | 3 ++- .../ResizeGroup.OverflowSet.Example.tsx.shot | 3 ++- .../react/src/components/Dropdown/Dropdown.styles.ts | 7 ++++--- .../Dropdown/__snapshots__/Dropdown.test.tsx.snap | 12 ++++++++---- 15 files changed, 51 insertions(+), 23 deletions(-) create mode 100644 change/@fluentui-react-ddb34d7a-c047-4443-a0cd-2eda22ec6308.json diff --git a/change/@fluentui-react-ddb34d7a-c047-4443-a0cd-2eda22ec6308.json b/change/@fluentui-react-ddb34d7a-c047-4443-a0cd-2eda22ec6308.json new file mode 100644 index 0000000000000..b4ba7ef4242ba --- /dev/null +++ b/change/@fluentui-react-ddb34d7a-c047-4443-a0cd-2eda22ec6308.json @@ -0,0 +1,7 @@ +{ + "type": "patch", + "comment": "Dropdown: Removing unintended extra height.", + "packageName": "@fluentui/react", + "email": "Humberto.Morimoto@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/packages/react-examples/src/react/__snapshots__/ChoiceGroup.Custom.Example.tsx.shot b/packages/react-examples/src/react/__snapshots__/ChoiceGroup.Custom.Example.tsx.shot index 0d14f7e355ac7..6da0d0679c3df 100644 --- a/packages/react-examples/src/react/__snapshots__/ChoiceGroup.Custom.Example.tsx.shot +++ b/packages/react-examples/src/react/__snapshots__/ChoiceGroup.Custom.Example.tsx.shot @@ -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; } > = 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', diff --git a/packages/react/src/components/Dropdown/__snapshots__/Dropdown.test.tsx.snap b/packages/react/src/components/Dropdown/__snapshots__/Dropdown.test.tsx.snap index 17c504b851a9a..fe0aa4f410433 100644 --- a/packages/react/src/components/Dropdown/__snapshots__/Dropdown.test.tsx.snap +++ b/packages/react/src/components/Dropdown/__snapshots__/Dropdown.test.tsx.snap @@ -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; } >