Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Revert displaying popovers as modals on mobile for now #7392

Merged
merged 6 commits into from
Nov 19, 2024

Conversation

devongovett
Copy link
Member

Until we implement trays, we won't display popovers as modals on mobile. Also includes some example improvements, and fixes #7352 (comment)

@rspbot
Copy link

rspbot commented Nov 19, 2024

@rspbot
Copy link

rspbot commented Nov 19, 2024

snowystinger
snowystinger previously approved these changes Nov 19, 2024
import {style} from '../style' with {type: 'macro'};
import {StyleString} from '../style/types' with {type: 'macro'};
import {useDOMRef, useIsMobileDevice} from '@react-spectrum/utils';
import {useDOMRef} from '@react-spectrum/utils';

export interface PopoverProps extends UnsafeStyles, Omit<AriaPopoverProps, 'arrowSize' | 'isNonModal' | 'arrowBoundaryOffset' | 'isKeyboardDismissDisabled' | 'shouldCloseOnInteractOutside' | 'shouldUpdatePosition'> {
Copy link
Member

Choose a reason for hiding this comment

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

should we get rid of the mobileType prop for now if we're not showing popovers as modals on mobile?

@rspbot
Copy link

rspbot commented Nov 19, 2024

@rspbot
Copy link

rspbot commented Nov 19, 2024

## API Changes

@react-spectrum/s2

/@react-spectrum/s2:Popover

 Popover {
   UNSAFE_className?: string
   UNSAFE_style?: CSSProperties
   aria-describedby?: string
   aria-details?: string
   aria-label?: string
   aria-labelledby?: string
   children?: ReactNode | (DialogRenderProps) => ReactNode
   containerPadding?: number = 12
   crossOffset?: number = 0
   hideArrow?: boolean = false
   id?: string | undefined
-  mobileType?: 'modal' | 'fullscreen' | 'fullscreenTakeover'
   offset?: number = 8
   placement?: Placement = 'bottom'
   role?: 'dialog' | 'alertdialog' = 'dialog'
   shouldFlip?: boolean = true
   slot?: string | null
   styles?: StylesProp
 }

/@react-spectrum/s2:PopoverProps

 PopoverProps {
   UNSAFE_className?: string
   UNSAFE_style?: CSSProperties
   UNSTABLE_portalContainer?: Element = document.body
   boundaryElement?: Element = document.body
   children?: ReactNode | ((PopoverRenderProps & {
     defaultChildren: ReactNode | undefined
 })) => ReactNode
   className?: string | ((PopoverRenderProps & {
     defaultClassName: string | undefined
 })) => string
   containerPadding?: number = 12
   crossOffset?: number = 0
   defaultOpen?: boolean
   hideArrow?: boolean = false
   isEntering?: boolean
   isExiting?: boolean
   isOpen?: boolean
   maxHeight?: number
-  mobileType?: 'modal' | 'fullscreen' | 'fullscreenTakeover'
   offset?: number = 8
   onOpenChange?: (boolean) => void
   placement?: Placement = 'bottom'
   scrollRef?: RefObject<Element | null> = overlayRef
   size?: 'S' | 'M' | 'L'
   slot?: string | null
   style?: CSSProperties | ((PopoverRenderProps & {
     defaultStyle: CSSProperties
 })) => CSSProperties | undefined
   styles?: StyleString
   trigger?: string
   triggerRef?: RefObject<Element | null>
 }

Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

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

Tested locally, verified that Combobox/Picker/ContextualHelp, etc are all rendering as popovers again now and that FullScreenDialog has additional padding when the buttons shift down now

@devongovett devongovett added this pull request to the merge queue Nov 19, 2024
Copy link
Member

@ktabors ktabors left a comment

Choose a reason for hiding this comment

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

On my iPhone iOS17 I keep seeing it open and immediately close. It's intermittent and I can't figure out reproduction.

Probably an existing issue, but arrow to the right/left direction prop is showing a line between the arrow and the popover.
image

@@ -126,6 +123,9 @@ let popover = style({
L: 576
}
},
// Don't be larger than full screen minus 2 * containerPadding
maxWidth: '[calc(100vw - 24px)]',
Copy link
Member

Choose a reason for hiding this comment

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

If there are scrollbars showing, this will still position and look okay, right?

Merged via the queue into main with commit f33288c Nov 19, 2024
30 checks passed
@devongovett devongovett deleted the dialog-fixes branch November 19, 2024 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants