react-modal-sheet icon indicating copy to clipboard operation
react-modal-sheet copied to clipboard

Animation Not Working in Safari

Open ankur-kunaico opened this issue 3 years ago • 2 comments

Using it with FocusTrap


header: {
    opacity: 0,
    [theme.breakpoints.up('xl')]: {
      '& .react-modal-sheet-header': {
        height: '32px !important',
      },
      '& + .react-modal-sheet-content': {
        flex: '0 1 auto !important',
        overflow: 'visible !important',
      },
    },
  },
  content: {
    display: 'flex',
    flexDirection: 'column',
    justifyContent: 'space-between',
    height: '100%',
    [theme.breakpoints.up('xl')]: {
      flexDirection: 'row',
      flexWrap: 'wrap',
    },

<Sheet
        isOpen={props.isOpen}
        onClose={() => props.setOpen(false)}
        snapPoints={width > widthBreakpoint ? [195] : [600]}>
        <Sheet.Container>
          <Sheet.Header className={classes.header} />
          <FocusTrap active={props.isOpen}>
            <Sheet.Content>
         {...Content}
            </Sheet.Content>
          </FocusTrap>
        </Sheet.Container>
        <Sheet.Backdrop />
      </Sheet>

Without Focus Trap Its working as expected ezgif com-gif-maker

ankur-kunaico avatar Feb 08 '22 02:02 ankur-kunaico

Interesting 🤔 This is probably due to the fact that I'm mapping over the children and passing them a custom key for AnimatePresence to work properly.

Can you try to put the FocusTrap between Sheet and SheetContainer? I'm doing that in my A11ySheet demo and worked okay.

const Example = () => {
  return (
    <Sheet>
      <FocusTrap>
        <SheetContainer>
          /* ...content... */
        </SheetContainer>
      </FocusTrap>
    </Sheet>
  );
}

Temzasse avatar Mar 10 '22 10:03 Temzasse

@Temzasse I'm using your A11ySheet example but got the same issue.. but removing restoreFocus "fixes" it. Any idea what the culprit could be?

EDIT Just realized FocusScope is from another library https://github.com/adobe/react-spectrum.

stephanschubert avatar Jul 09 '22 17:07 stephanschubert