Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/@react-aria/focus/src/FocusScope.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,9 @@ function useFocusContainment(scopeRef: RefObject<Element[]>, contain: boolean) {
};
}, [scopeRef, contain]);

// This is a useLayoutEffect so it is guaranteed to run before our async synthetic blur
// eslint-disable-next-line arrow-body-style
useEffect(() => {
useLayoutEffect(() => {
return () => {
if (raf.current) {
cancelAnimationFrame(raf.current);
Expand Down
5 changes: 3 additions & 2 deletions packages/@react-aria/interactions/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ export function useSyntheticBlurEvent<Target = Element>(onBlur: (e: ReactFocusEv
stateRef.current.observer = new MutationObserver(() => {
if (stateRef.current.isFocused && target.disabled) {
stateRef.current.observer.disconnect();
target.dispatchEvent(new FocusEvent('blur'));
target.dispatchEvent(new FocusEvent('focusout', {bubbles: true}));
let relatedTargetEl = target === document.activeElement ? null : document.activeElement;
target.dispatchEvent(new FocusEvent('blur', {relatedTarget: relatedTargetEl}));
target.dispatchEvent(new FocusEvent('focusout', {bubbles: true, relatedTarget: relatedTargetEl}));
}
});

Expand Down