Skip to content

Commit c058d2d

Browse files
committed
Hotfixes copy button tooltip
1 parent 1c317ae commit c058d2d

3 files changed

Lines changed: 21 additions & 5 deletions

File tree

frontend/src/components/pages/acls/user-create.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,10 @@ const CreateUserModal = ({ state, onCreateUser, onCancel }: CreateUserModalProps
292292
/>
293293
</Tooltip>
294294
<Tooltip hasArrow label={'Copy password'} placement="top">
295-
<CopyButton content={state.password} variant="ghost" />
295+
{/* Wrapper needed: CopyButton doesn't forward refs, so Chakra Tooltip can't position itself without a DOM element to measure */}
296+
<Box as="span" display="inline-flex">
297+
<CopyButton content={state.password} variant="ghost" />
298+
</Box>
296299
</Tooltip>
297300
</Flex>
298301
<Checkbox
@@ -395,7 +398,10 @@ const CreateUserConfirmationModal = ({
395398
<PasswordInput isDisabled={true} isReadOnly={true} name="test" value={password} />
396399

397400
<Tooltip hasArrow label={'Copy password'} placement="top">
398-
<CopyButton content={password} variant="ghost" />
401+
{/* Wrapper needed: CopyButton doesn't forward refs, so Chakra Tooltip can't position itself without a DOM element to measure */}
402+
<Box as="span" display="inline-flex">
403+
<CopyButton content={password} variant="ghost" />
404+
</Box>
399405
</Tooltip>
400406
</Flex>
401407
</Box>

frontend/src/components/pages/acls/user-edit-modals.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { create } from '@bufbuild/protobuf';
44
import { ConnectError } from '@connectrpc/connect';
55
import {
6+
Box,
67
Button,
78
Checkbox,
89
CopyButton,
@@ -115,7 +116,10 @@ export const ChangePasswordModal = ({ userName, isOpen, setIsOpen }: ChangePassw
115116
/>
116117
</Tooltip>
117118
<Tooltip hasArrow label={'Copy password'} placement="top">
118-
<CopyButton content={password} variant="ghost" />
119+
{/* Wrapper needed: CopyButton doesn't forward refs, so Chakra Tooltip can't position itself without a DOM element to measure */}
120+
<Box as="span" display="inline-flex">
121+
<CopyButton content={password} variant="ghost" />
122+
</Box>
119123
</Tooltip>
120124
</Flex>
121125
<Checkbox

frontend/src/components/pages/users/create-user-confirmation-modal.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ export const CreateUserConfirmationModal = ({
5858
</Text>
5959

6060
<Tooltip hasArrow label={'Copy username'} placement="top">
61-
<CopyButton content={username} variant="ghost" />
61+
{/* Wrapper needed: CopyButton doesn't forward refs, so Chakra Tooltip can't position itself without a DOM element to measure */}
62+
<Box as="span" display="inline-flex">
63+
<CopyButton content={username} variant="ghost" />
64+
</Box>
6265
</Tooltip>
6366
</Flex>
6467
</Box>
@@ -71,7 +74,10 @@ export const CreateUserConfirmationModal = ({
7174
<PasswordInput isDisabled={true} isReadOnly={true} name="test" value={password} />
7275

7376
<Tooltip hasArrow label={'Copy password'} placement="top">
74-
<CopyButton content={password} variant="ghost" />
77+
{/* Wrapper needed: CopyButton doesn't forward refs, so Chakra Tooltip can't position itself without a DOM element to measure */}
78+
<Box as="span" display="inline-flex">
79+
<CopyButton content={password} variant="ghost" />
80+
</Box>
7581
</Tooltip>
7682
</Flex>
7783
</Box>

0 commit comments

Comments
 (0)