PrivacyDropdown: fix Overlay target

This commit is contained in:
Alex Gleason 2022-05-30 14:50:10 -05:00
parent faf48d17b9
commit 0051fd8eec
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -156,6 +156,7 @@ const PrivacyDropdown: React.FC<IPrivacyDropdown> = ({
unavailable, unavailable,
}) => { }) => {
const intl = useIntl(); const intl = useIntl();
const node = useRef<HTMLDivElement>(null);
const activeElement = useRef<HTMLElement | null>(null); const activeElement = useRef<HTMLElement | null>(null);
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
@ -235,7 +236,7 @@ const PrivacyDropdown: React.FC<IPrivacyDropdown> = ({
const valueOption = options.find(item => item.value === value); const valueOption = options.find(item => item.value === value);
return ( return (
<div className={classNames('privacy-dropdown', placement, { active: open })} onKeyDown={handleKeyDown}> <div className={classNames('privacy-dropdown', placement, { active: open })} onKeyDown={handleKeyDown} ref={node}>
<div className={classNames('privacy-dropdown__value', { active: valueOption && options.indexOf(valueOption) === 0 })}> <div className={classNames('privacy-dropdown__value', { active: valueOption && options.indexOf(valueOption) === 0 })}>
<IconButton <IconButton
className='text-gray-400 hover:text-gray-600' className='text-gray-400 hover:text-gray-600'
@ -247,7 +248,7 @@ const PrivacyDropdown: React.FC<IPrivacyDropdown> = ({
/> />
</div> </div>
<Overlay show={open} placement={placement} target={this}> <Overlay show={open} placement={placement} target={node.current}>
<PrivacyDropdownMenu <PrivacyDropdownMenu
items={options} items={options}
value={value} value={value}