Refactor event path handling to use getComposedPath utility

- Replaced direct usage of event.composedPath() with a new utility function getComposedPath in Control component.
- Updated includeFromEvent function to utilize getComposedPath for better compatibility.
- Implemented getComposedPath function to ensure consistent event path retrieval across different browsers.
This commit is contained in:
Harvey Zack committed 2025-08-03 11:43:01 +08:00
1 parent 412b8e7fa7
commit 05ce97c6fd
12 files changed
+41 -14

No files matched your search

+2 -1
View File
@@ -20,6 +20,7 @@ import {
inverseClass,
createElement,
includeFromEvent,
getComposedPath,
} from '../utils';
export default class Control extends Component {
@@ -265,7 +266,7 @@ export default class Control extends Component {
}
const event = proxy($list, 'click', async (event) => {
const path = event.composedPath() || [];
const path = getComposedPath(event);
const item = option.selector.find(
(item) => item.$control_item === path.find(($item) => item.$control_item === $item),
);