Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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