Skip to content

Commit

Permalink
Let ModalCard render without portal in e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
andrey-medvedev-vk committed Oct 31, 2024
1 parent 0386808 commit d95c854
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export const ModalCardPlayground = (props: ComponentPlaygroundProps) => {
<div style={{ height: 500, transform: 'translateZ(0)' }}>
<ModalRoot
activeModal={props.nav}
usePortal={false}
// Note: с включенным фокусом ломаются скриншоты на движке Webkit из-за фокуса сразу
// на несколько окон
noFocusToDialog
Expand Down
2 changes: 1 addition & 1 deletion packages/vkui/src/components/ModalRoot/ModalRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ class ModalRootTouchComponent extends React.Component<
}

return (
<ModalPopoutPortal className={styles.host}>
<ModalPopoutPortal className={styles.host} usePortal={this.props.usePortal}>
<TouchRootContext.Provider value={true}>
<ModalRootContext.Provider value={this.modalRootContext}>
<Touch
Expand Down
3 changes: 3 additions & 0 deletions packages/vkui/src/components/ModalRoot/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { DOMContextInterface } from '../../lib/dom';
import type { HasPlatform } from '../../types';
import type { AppRootPortalProps } from '../AppRoot/AppRootPortal';
import type { ConfigProviderContextInterface } from '../ConfigProvider/ConfigProviderContext';

export type ModalType = 'page' | 'card';
Expand Down Expand Up @@ -105,6 +106,8 @@ export interface ModalRootProps {
* Отключает фокус на контейнер диалогового окна при открытии.
*/
noFocusToDialog?: boolean;

usePortal?: AppRootPortalProps['usePortal'];
}

export interface ModalRootWithDOMProps extends HasPlatform, ModalRootProps, DOMContextInterface {
Expand Down

0 comments on commit d95c854

Please sign in to comment.