Andarist / Andarist/use-onclickoutside
Don't trigger when scrolling down on mobile?
- 主要語言
- TypeScript
- 星號
- 496
- 分支
- 27
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Is there a way to make this **not** trigger when scrolling down on a mobile device?
Repro:
1. Go to https://beta.dnstools.ws/ on a mobile device
2. Select the "Ping" option
3. Open the "locations" dropdown
4. Scroll down by tapping and dragging on the body (not the dropdown list)
The dropdown list closes, but it should remain open.
Here's the code I'm using:
```js
import React, {useRef, useState} from 'react';
import useOnClickOutside from 'use-onclickoutside';
type Props = {
children: React.ReactNode;
id: string;
label: string;
};
export default function DropdownButton(props: Props) {
const rootRef = useRef(null);
const [isOpen, setIsOpen] = useState(false);
useOnClickOutside(rootRef, () => setIsOpen(false));
return (
setIsOpen(value => !value)}
type="button"
data-toggle="dropdown"
aria-haspopup={true}
aria-expanded={isOpen}>
{props.label}
{props.children}
);
}
```
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。