mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-27 20:14:49 +02:00
[eric] palettes: portal Cmd+K and Cmd+F to a body top layer so cards stop painting over them
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import React from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
|
||||
// A low-z or transformed ancestor traps position:fixed, so anything that must win every stacking fight mounts on body instead.
|
||||
const TOP_LAYER = 2147483647;
|
||||
|
||||
interface Props {
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
const TopLayerPortal: React.FC<Props> = ({ children }) => createPortal(
|
||||
<div style={{ position: 'fixed', inset: 0, zIndex: TOP_LAYER }}>{children}</div>,
|
||||
document.body,
|
||||
);
|
||||
|
||||
export default TopLayerPortal;
|
||||
Reference in New Issue
Block a user