material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

Fix: support get activeElement in shadow DOM

Open trinhnguyen-vn opened this issue 3 months ago • 1 comments

Details

This pr is for fixing 2 problems

  1. Component using document.activeElement cannot 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


  1. SSR runtime errror: getScrollbarSize utility throws error in SSR environment where window and document are undefined.

Solution: add defensive check in getScrollbarSize to handle undefined document/window

Issue details: image image

trinhnguyen-vn avatar Aug 17 '25 08:08 trinhnguyen-vn