Skip to content

Conversation

@bsunderhus
Copy link
Contributor

@bsunderhus bsunderhus commented Mar 29, 2023

Previous Behavior

PR #27248 introduced a regression where the scrollbar would always be visible due to a negative margin.

image

New Behavior

  1. removes declaration of the height: 100% from DialogContent, which makes height auto, which will properly vary DialogContent height taking into account the negative margin in cases where the scrollbar should be visible or not
  2. removes unnecessary height and width styles from DialogContent, DialogBody and DialogSurface

Related Issue(s)

@bsunderhus bsunderhus self-assigned this Mar 29, 2023
@bsunderhus bsunderhus marked this pull request as ready for review March 29, 2023 15:50
@bsunderhus bsunderhus requested a review from a team as a code owner March 29, 2023 15:50
@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 29, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit bded5d0:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@size-auditor
Copy link

size-auditor bot commented Mar 29, 2023

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: a36754d76ad5afb444c9f6975266bd32ba2e7b1d (build)

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 29, 2023

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-dialog
Dialog (including children components)
93.616 kB
27.452 kB
93.388 kB
27.408 kB
-228 B
-44 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
67.994 kB
18.395 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
207.4 kB
57.516 kB
react-components
react-components: FluentProvider & webLightTheme
38.819 kB
12.351 kB
react-portal-compat
PortalCompatProvider
6.446 kB
2.185 kB
🤖 This report was generated against a36754d76ad5afb444c9f6975266bd32ba2e7b1d

@fabricteam
Copy link
Collaborator

fabricteam commented Mar 29, 2023

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 920 891 5000
Button mount 596 588 5000
Field mount 1552 1541 5000
FluentProvider mount 1112 1077 5000
FluentProviderWithTheme mount 288 290 10
FluentProviderWithTheme virtual-rerender 283 287 10
FluentProviderWithTheme virtual-rerender-with-unmount 283 288 10
InfoButton mount 204 213 5000
MakeStyles mount 1386 1376 50000
Persona mount 2150 2060 5000
SpinButton mount 1862 1834 5000

@bsunderhus bsunderhus force-pushed the react-dialog/fix--DialogContent-scrollbar-always-visible branch from 6727304 to bded5d0 Compare March 30, 2023 08:45
@github-actions github-actions bot added this to the March Project Cycle Q1 2023 milestone Mar 30, 2023
@bsunderhus bsunderhus requested a review from ling1726 March 30, 2023 08:46
@lekoaf
Copy link
Contributor

lekoaf commented Mar 31, 2023

This seems to work. Did some quick testing on the Codesandbox.

I'm gonna have to do some changes to my code though because I add padding-top and padding-bottom to the <DialogContent/> which makes the scrollbars appear again. I felt that the dialog didn't have enough padding when you only use it for a small piece of text.

const useDialogStyles = makeStyles({
  sections: {
    display: 'flex',
    flexDirection: 'column',
    rowGap: tokens.spacingVerticalL,
    paddingTop: tokens.spacingVerticalS,
    paddingBottom: tokens.spacingVerticalXXXL,
  },
  title: {
    overflowWrap: 'break-word',
  },
})

function MyCustomDialog({
  open = true,
  onClose,
  title,
  children,
}) {
  const dialogStyles = useDialogStyles()

  return (
    <Dialog
      open={open}
      onOpenChange={(_event, data) => !data.open && onClose?.()}
    >
      <DialogSurface>
        <DialogBody>
          <DialogTitle className={dialogStyles.title}>{title}</DialogTitle>
          <DialogContent className={dialogStyles.sections}>{children}</DialogContent>
          <DialogActions>
            <DialogTrigger disableButtonEnhancement><Button /></DialogTrigger>
            <Button />
          </DialogActions>
        </DialogBody>
      </DialogSurface>
    </Dialog>
  )
}

@bsunderhus bsunderhus merged commit 263ea17 into microsoft:master Mar 31, 2023
marcosmoura added a commit to marcosmoura/fluentui that referenced this pull request Apr 4, 2023
* master: (39 commits)
  Added merge tests for custom styles (microsoft#27086)
  fix: make Option's checkIcon slot render conditionally (microsoft#27409)
  docs: add subcomponents to Combobox and Dropdown docs (microsoft#27410)
  Breadcrumb spec (microsoft#26742)
  bugfix(react-utilities): increments SlotRenderFunction signature to include children (microsoft#27377)
  fix: Menu should not steal focus on close (microsoft#27414)
  Fixed Overflow component when there's more then one children element (microsoft#27402)
  feat(scripts-executors): support custom base and printing all affected packages for checkIfPackagesAffected (microsoft#27364)
  applying package updates
  feat(scripts-tasks): make perf test setup generic (microsoft#26920)
  fix: ColorPicker preview color updated to ignore forced colors (microsoft#27394)
  fix: Fix babel build error on windows (microsoft#27406)
  chore(react-datepicker-compat): Add vr-tests and bundle-size fixtures for DatePicker (microsoft#27351)
  fix(react-dialog): DialogContent scrollbar always visible (microsoft#27367)
  docs: Add tokens search (microsoft#27265)
  chore(scripts-tasks): remove not needed api-extractor task logs (microsoft#27094)
  chore(react-tree): adds e2e flat tree tests (microsoft#27318)
  applying package updates
  Accessibility fix for empty vertical bar chart (microsoft#26254)
  fix(react-datepicker-compat): Fix theming issues with all themes and WHCM (microsoft#27361)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: DialogContent scrollbar always visible.

5 participants