Skip to content

Commit 0715e49

Browse files
authored
fix(AnalyticalTable): show vertical resizer while dragging (#6694)
1 parent 98c458c commit 0715e49

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

packages/main/src/components/AnalyticalTable/VerticalResizer.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useStylesheet, useI18nBundle } from '@ui5/webcomponents-react-base';
22
import type { MutableRefObject } from 'react';
33
import { useCallback, useEffect, useRef, useState } from 'react';
4+
import { createPortal } from 'react-dom';
45
import { DRAG_TO_RESIZE } from '../../i18n/i18n-defaults.js';
56
import { classNames, styleData } from './VerticalResizer.module.css.js';
67

@@ -136,6 +137,14 @@ export const VerticalResizer = (props: VerticalResizerProps) => {
136137
isInitial.current = false;
137138
}, [rowsLength, visibleRows]);
138139

140+
const [allowed, setAllowed] = useState(false);
141+
useEffect(() => {
142+
setAllowed(true);
143+
}, []);
144+
if (!allowed) {
145+
return null;
146+
}
147+
139148
return (
140149
<div
141150
className={classNames.container}
@@ -145,12 +154,15 @@ export const VerticalResizer = (props: VerticalResizerProps) => {
145154
role="separator"
146155
title={i18nBundle.getText(DRAG_TO_RESIZE)}
147156
>
148-
{resizerPosition && isDragging && (
149-
<div
150-
className={classNames.resizer}
151-
style={{ top: resizerPosition.top, left: resizerPosition.left, width: resizerPosition.width }}
152-
/>
153-
)}
157+
{resizerPosition &&
158+
isDragging &&
159+
createPortal(
160+
<div
161+
className={classNames.resizer}
162+
style={{ top: resizerPosition.top, left: resizerPosition.left, width: resizerPosition.width }}
163+
/>,
164+
document.body
165+
)}
154166
</div>
155167
);
156168
};

0 commit comments

Comments
 (0)