Skip to content

Commit

Permalink
Fix tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
dani-mp committed Jan 21, 2025
1 parent 736b744 commit 2dd015d
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
TextInput,
Tooltip,
} from "@prismicio/editor-ui";
import { useRef } from "react";
import { useRef, useState } from "react";
import { Checkbox, Flex, Label } from "theme-ui";

import { Col } from "@/legacy/components/Flex";
Expand All @@ -23,8 +23,8 @@ interface CommonCheckboxProps {
export function DisplayTextCheckbox(props: CommonCheckboxProps) {
const { checked, height = 130, setFieldValue } = props;

// Ref to the container to position the tooltip inside it.
const container = useRef<HTMLDivElement>(null);
// Container to position the tooltip inside it.
const [container, setContainer] = useState<HTMLElement | null>(null);

return (
<Col>
Expand All @@ -41,7 +41,7 @@ export function DisplayTextCheckbox(props: CommonCheckboxProps) {
justifyContent="space-between"
alignItems="center"
width="100%"
ref={container}
ref={setContainer}
>
<Flex>
<Checkbox
Expand All @@ -53,7 +53,7 @@ export function DisplayTextCheckbox(props: CommonCheckboxProps) {
Allow display text
</Flex>
<Tooltip
containerRef={container}
container={container}
align="end"
content="Allow editors to customize the link display text"
>
Expand Down

0 comments on commit 2dd015d

Please sign in to comment.