message: dont need to check if modalRef is definted
diff: @@ -11,7 +11,7 @@ function focusable(el) {
  function useDialog({modalRef, isOpen, onDismiss, initialFocusRef, closeButtonRef, returnFocusRef} = {}) {
  const onClickOutside = useCallback(
  (e) => {
  - if (modalRef && modalRef.current && !modalRef.current.contains(e.target)) {
  + if (modalRef.current && !modalRef.current.contains(e.target)) {
  onDismiss()
  if (returnFocusRef && returnFocusRef.current) {
  returnFocusRef.current.focus()
  @@ -65,7 +65,8 @@ function useDialog({modalRef, isOpen, onDismiss, initialFocusRef, closeButtonRef
  [getFocusableItem]
  )
  - const onKeyDown = useCallback((event) => {
  + const onKeyDown = useCallback(
  + (event) => {
  switch (event.key) {
  case 'Tab':
  handleTab(event)
  @@ -78,7 +79,9 @@ function useDialog({modalRef, isOpen, onDismiss, initialFocusRef, closeButtonRef
  event.stopPropagation()
  break
  }
  - }, [handleTab, onDismiss, returnFocusRef])
  + },
  + [handleTab, onDismiss, returnFocusRef]
  + )
  const getDialogProps = () => {
  return {onKeyDown}
  