Skip to content

Commit

Permalink
Make popout root fixed on desktop (#5641)
Browse files Browse the repository at this point in the history
Required for ActionSheet passed to SplitLayout as popout.
Useful for situation when page content is scrolled down below
the fold. Absolutely positioned popout root would stay on top of the
page and won't catch click to propogate it to the body.
If PopoutRoot cannot catch the click then close on click
might not work for ActionSheet as click might not be catched and handled by body
handler in case body is not taken full page size (when it's children
are positioned fixed/absolutely).

Should be pretty safe change as absolutely it was positioned initially
for all cases and lately we changed it to fixed specially for mobile
(see 91f5b01#diff-310629b0806cf5a229d2859420471efd9c563b0c3e2422ecf8a1f82310952180L8-L16).
  • Loading branch information
mendrew authored and actions-user committed Aug 21, 2023
1 parent 2373626 commit 1c8c7d6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
4 changes: 0 additions & 4 deletions packages/vkui/src/components/PopoutRoot/PopoutRoot.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
height: 100%;
}

.PopoutRoot__popout--absolute {
position: absolute;
}

.PopoutRoot__modal {
position: fixed;
left: 0;
Expand Down
14 changes: 1 addition & 13 deletions packages/vkui/src/components/PopoutRoot/PopoutRoot.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react';
import { classNames } from '@vkontakte/vkjs';
import { useAdaptivityWithJSMediaQueries } from '../../hooks/useAdaptivityWithJSMediaQueries';
import { blurActiveElement, useDOM } from '../../lib/dom';
import { HasRootRef } from '../../types';
import { AppRootPortal } from '../AppRoot/AppRootPortal';
Expand All @@ -11,18 +10,7 @@ interface PopoutRootPopoutProps {
}

const PopoutRootPopout = ({ children }: PopoutRootPopoutProps) => {
const { isDesktop } = useAdaptivityWithJSMediaQueries();

return (
<div
className={classNames(
styles['PopoutRoot__popout'],
isDesktop && styles['PopoutRoot__popout--absolute'],
)}
>
{children}
</div>
);
return <div className={classNames(styles['PopoutRoot__popout'])}>{children}</div>;
};

interface PopoutRootModalProps {
Expand Down

0 comments on commit 1c8c7d6

Please sign in to comment.