material-ui
material-ui copied to clipboard
Fix: support get activeElement in shadow DOM
- [x] I have followed (at least) the PR section of the contributing guide.
Details
This pr is for fixing 2 problems
- Component using
document.activeElementcannot detect focused elements inside shadow roots, this break keyborad navigation and focus management in web component using shadow DOM. Affected component: MenuLlist, FocusTrap,...
Solution: create new utility getActiveElement: traverse shadow DOM recursively to find active element
Related issues: https://github.com/mui/material-ui/issues/34061 , https://github.com/mui/material-ui/issues/44147
- SSR runtime errror:
getScrollbarSizeutility throws error in SSR environment where window and document are undefined.
Solution: add defensive check in getScrollbarSize to handle undefined document/window
Issue details: