@charcoal-ui/react 5.2.0 → 5.3.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,6 +44,7 @@ export function DropdownPopover({ children, ...props }: DropdownPopoverProps) {
44
44
  onClose={props.onClose}
45
45
  popoverRef={ref}
46
46
  triggerRef={props.triggerRef}
47
+ inertWorkaround={props.inertWorkaround}
47
48
  >
48
49
  {children}
49
50
  </Popover>
@@ -11,6 +11,15 @@ export type PopoverProps = {
11
11
  children: ReactNode
12
12
  triggerRef: RefObject<Element | null>
13
13
  popoverRef?: RefObject<HTMLDivElement | null>
14
+ /**
15
+ * A tmp workaround for react-aria above 3.27.3 setting overlay element to inert and causing background to be clickable.
16
+ * This may become default at next major.
17
+ * https://github.com/adobe/react-spectrum/pull/8796
18
+ * https://github.com/adobe/react-spectrum/issues/8784
19
+ *
20
+ * @default false
21
+ */
22
+ inertWorkaround?: boolean
14
23
  }
15
24
 
16
25
  const _empty = () => null
@@ -50,6 +59,10 @@ export default function Popover(props: PopoverProps) {
50
59
  <Overlay portalContainer={document.body}>
51
60
  <div
52
61
  {...underlayProps}
62
+ // https://github.com/adobe/react-spectrum/issues/8784#issuecomment-3234771154
63
+ {...(props.inertWorkaround
64
+ ? { 'data-react-aria-top-layer': true, onClick: props.onClose }
65
+ : {})}
53
66
  style={{
54
67
  position: 'fixed',
55
68
  zIndex:
@@ -11,6 +11,7 @@ import { useVisuallyHidden } from '@react-aria/visually-hidden'
11
11
  import { AssistiveText } from '../TextField/AssistiveText'
12
12
  import { useClassNames } from '../../_lib/useClassNames'
13
13
  import { useId } from '@react-aria/utils'
14
+ import { PopoverProps } from './Popover'
14
15
 
15
16
  export type DropdownSelectorProps = {
16
17
  label: string
@@ -30,7 +31,7 @@ export type DropdownSelectorProps = {
30
31
  children: MenuListChildren
31
32
  onChange: (value: string) => void
32
33
  className?: string
33
- }
34
+ } & Pick<PopoverProps, 'inertWorkaround'>
34
35
 
35
36
  export default function DropdownSelector({
36
37
  onChange,
@@ -126,6 +127,7 @@ export default function DropdownSelector({
126
127
  onClose={() => setIsOpen(false)}
127
128
  triggerRef={triggerRef}
128
129
  value={props.value}
130
+ inertWorkaround={props.inertWorkaround}
129
131
  >
130
132
  <MenuList
131
133
  value={props.value}