Skip to content

Commit

Permalink
feat: support ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
泊淞 committed Mar 4, 2025
1 parent eb475fb commit 23c3659
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alifd/overlay",
"version": "0.3.6",
"version": "0.3.7",
"description": "overlay base component",
"files": [
"demo/",
Expand Down Expand Up @@ -67,7 +67,7 @@
"url": "https://github.com/alibaba-fusion/overlay.git"
},
"license": "MIT",
"homepage": "https://unpkg.com/@alifd/overlay@0.3.6/build/index.html",
"homepage": "https://unpkg.com/@alifd/overlay@0.3.7/build/index.html",
"lint-staged": {
"@(src|scripts|docs/*/demo)/**/*.@(js|jsx|ts|tsx|md)": [
"prettier --write"
Expand Down
8 changes: 5 additions & 3 deletions src/overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ const Overlay = React.forwardRef<HTMLDivElement, OverlayProps>((props, ref) => {
// - react17 中,如果弹窗 mousedown 阻止了 e.stopPropagation(), 那么 document 就不会监听到事件,因为事件冒泡到挂载节点 rootElement 就中断了。
// - https://reactjs.org/blog/2020/08/10/react-v17-rc.html#changes-to-event-delegation
useListener(
document,
typeof document !== 'undefined' ? document : null,
'mousedown',
clickEvent,
false,
Expand All @@ -392,7 +392,7 @@ const Overlay = React.forwardRef<HTMLDivElement, OverlayProps>((props, ref) => {
}
};
useListener(
document,
typeof document !== 'undefined' ? document : null,
'keydown',
keydownEvent,
false,
Expand All @@ -406,7 +406,9 @@ const Overlay = React.forwardRef<HTMLDivElement, OverlayProps>((props, ref) => {
updatePosition();
};
useListener(
overflowRef.current?.map((t) => (t === document.documentElement ? document : t)),
typeof document !== 'undefined'
? overflowRef.current?.map((t) => (t === document.documentElement ? document : t))
: null,
'scroll',
scrollEvent,
false,
Expand Down

0 comments on commit 23c3659

Please sign in to comment.