(
onInternalBlur();
};
+ // ============================== Scroll ===============================
+ const onInternalPopupScroll: React.UIEventHandler<
+ HTMLDivElement
+ > = event => {
+ onPopupScroll?.(event);
+ };
+
// ============================== Render ==============================
+
return (
(
selectOption,
onFocus: onDropdownFocus,
onBlur: onDropdownBlur,
+ onScroll: onInternalPopupScroll,
}}
>
void;
onFocus: React.FocusEventHandler;
onBlur: React.FocusEventHandler;
+ onScroll: React.UIEventHandler;
}
// We will never use default, here only to fix TypeScript warning
diff --git a/tests/Mentions.spec.tsx b/tests/Mentions.spec.tsx
index 939ea6d..2c60d60 100644
--- a/tests/Mentions.spec.tsx
+++ b/tests/Mentions.spec.tsx
@@ -300,6 +300,17 @@ describe('Mentions', () => {
expect(container.firstChild).toHaveClass('rc-mentions-disabled');
});
+ it('onPopupScroll should work', () => {
+ const onPopupScroll = jest.fn();
+ const { container, baseElement } = renderMentions({ onPopupScroll });
+ simulateInput(container, '@');
+ act(() => {
+ jest.runAllTimers();
+ });
+ fireEvent.scroll(baseElement.querySelector('.rc-mentions-dropdown-menu'));
+ expect(onPopupScroll).toHaveBeenCalled();
+ });
+
describe('nativeElement', () => {
it('work', () => {
const ref = createRef();