Skip to content

Commit

Permalink
use ts
Browse files Browse the repository at this point in the history
  • Loading branch information
dbadura committed Jul 19, 2024
1 parent 75abd1c commit c64c186
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/shared/components/DescriptionHint/DescriptionHint.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
import { Button, Popover, Text } from '@ui5/webcomponents-react';
import { createPortal } from 'react-dom';
import { useRef, useState } from 'react';
import { CSSProperties, ReactNode, useRef, useState } from 'react';
import { uniqueId } from 'lodash';

type HintButtonProps = {
setShowTitleDescription: any;
showTitleDescription: boolean;
description: string | ReactNode;
style?: CSSProperties;
dataTestID?: string;
};

export function HintButton({
setShowTitleDescription,
showTitleDescription,
description,
style,
dataTestID = null,
}) {
dataTestID,
}: HintButtonProps) {
const [uniqueID] = useState(uniqueId('id-'));
const descBtnRef = useRef(null);

return (
<>
<Button
Expand All @@ -31,6 +40,7 @@ export function HintButton({
opener={`descriptionOpener-${uniqueID}`}
//Point initial focus to other component removes the focus from the link in description
onAfterOpen={() => {
// @ts-ignore
descBtnRef.current.focus();
}}
open={showTitleDescription}
Expand Down

0 comments on commit c64c186

Please sign in to comment.