| 141 | }; |
| 142 | |
| 143 | let onTriggerFocus = e => { |
| 144 | if (ignoreFocus.current) { |
| 145 | ignoreFocus.current = false; |
| 146 | return; |
| 147 | } |
| 148 | |
| 149 | // Prevent browser focusing the link on long press when focus is already in the popover. |
| 150 | if (state.isOpen && e.relatedTarget === popoverRef.current) { |
| 151 | focusWithoutScrolling(popoverRef.current as FocusableElement); |
| 152 | return; |
| 153 | } |
| 154 | |
| 155 | if (isFocusVisible.current) { |
| 156 | // Open after the warmup delay on keyboard focus, not immediately like a tooltip. This way |
| 157 | // tabbing quickly through the page doesn't open previews (and add their tab stops); the |
| 158 | // delay ensures the user is actually interested in the link's details. |
| 159 | state.open(); |
| 160 | } |
| 161 | }; |
| 162 | |
| 163 | useEvent(triggerRef, 'react-aria-focus-scope-restore', e => { |
| 164 | e.preventDefault(); |
nothing calls this directly
no test coverage detected