Skip to content

Commit

Permalink
chore: ignore body rect
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Mar 16, 2023
1 parent 5d63826 commit 8615e3a
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/demos/body-overflow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Body Overflow
nav:
title: Demo
path: /demo
---

<code src="../examples/body-overflow.tsx"></code>
63 changes: 63 additions & 0 deletions docs/examples/body-overflow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/* eslint no-console:0 */
import Trigger from 'rc-trigger';
import React from 'react';
import '../../assets/index.less';

export default () => {
return (
<React.StrictMode>
<style
dangerouslySetInnerHTML={{
__html: `
body {
overflow-x: hidden;
}
`,
}}
/>

<Trigger
arrow
// forceRender
action="click"
popup={
<div
style={{
background: 'yellow',
border: '1px solid blue',
width: 200,
height: 60,
opacity: 0.9,
}}
>
Popup
</div>
}
popupStyle={{ boxShadow: '0 0 5px red' }}
popupAlign={{
points: ['tc', 'bc'],
overflow: {
shiftX: 50,
adjustY: true,
},
offset: [0, -10],
htmlRegion: 'scroll',
}}
>
<span
style={{
background: 'green',
color: '#FFF',
paddingBlock: 30,
paddingInline: 70,
opacity: 0.9,
transform: 'scale(0.6)',
display: 'inline-block',
}}
>
Target
</span>
</Trigger>
</React.StrictMode>
);
};
4 changes: 4 additions & 0 deletions src/hooks/useAlign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,10 @@ export default function useAlign(
};

(scrollerList || []).forEach((ele) => {
if (ele instanceof HTMLBodyElement) {
return;
}

const eleRect = ele.getBoundingClientRect();
const {
offsetHeight: eleOutHeight,
Expand Down

0 comments on commit 8615e3a

Please sign in to comment.