(props)
| 59 | } |
| 60 | |
| 61 | function Popover(props) { |
| 62 | let ref = React.useRef(undefined); |
| 63 | let {popoverRef = ref, isOpen, onClose, children} = props; |
| 64 | |
| 65 | // Handle events that should cause the popup to close, |
| 66 | // e.g. blur, clicking outside, or pressing the escape key. |
| 67 | let {overlayProps} = useOverlay( |
| 68 | { |
| 69 | isOpen, |
| 70 | onClose, |
| 71 | shouldCloseOnBlur: true, |
| 72 | isDismissable: true |
| 73 | }, |
| 74 | popoverRef |
| 75 | ); |
| 76 | |
| 77 | // Add a hidden <DismissButton> component at the end of the popover |
| 78 | // to allow screen reader users to dismiss the popup easily. |
| 79 | return ( |
| 80 | <FocusScope restoreFocus> |
| 81 | <div |
| 82 | {...overlayProps} |
| 83 | ref={popoverRef} |
| 84 | style={{ |
| 85 | position: 'absolute', |
| 86 | width: '100%', |
| 87 | border: '1px solid gray', |
| 88 | background: 'lightgray', |
| 89 | marginTop: 4 |
| 90 | }}> |
| 91 | {children} |
| 92 | <DismissButton onDismiss={onClose} /> |
| 93 | </div> |
| 94 | </FocusScope> |
| 95 | ); |
| 96 | } |
| 97 | |
| 98 | function ListBox(props) { |
| 99 | let ref = React.useRef(undefined); |
nothing calls this directly
no test coverage detected