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 はまだ評価されていません。