From dff9a4676657e8929c9e55f6b841fd19f866136d Mon Sep 17 00:00:00 2001 From: Juwon Jeong Date: Thu, 5 Dec 2024 17:00:26 +0900 Subject: [PATCH] WRR-11077: Fixed Scroller to prevent the native scrolling behavior caused by keydown events when the popup is opened (#3297) * WRR-11077: Fixed Scroller to prevent the native scrolling behavior caused by keydown events when the popup is opened Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com) * Apply review to remove spotlight dependency in ui Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com) * Apply review Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com) * Added optional chaining to handle cases where props.preventScroll does not exist Enact-DCO-1.0-Signed-off-by: Juwon Jeong (juwon.jeong@lge.com) --- packages/ui/useScroll/useScroll.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/ui/useScroll/useScroll.js b/packages/ui/useScroll/useScroll.js index b6a635e8f4..83dd113243 100644 --- a/packages/ui/useScroll/useScroll.js +++ b/packages/ui/useScroll/useScroll.js @@ -132,6 +132,7 @@ const useScrollBase = (props) => { delete rest.onScrollStart; delete rest.onScrollStop; delete rest.onWheel; + delete rest.preventScroll; // scrollMode 'native' delete rest.removeEventListeners; delete rest.scrollStopOnScroll; // scrollMode 'native' delete rest.scrollTo; @@ -812,6 +813,7 @@ const useScrollBase = (props) => { scrollByPage(ev.keyCode); } } else { + props.preventScroll?.(ev); forward('onKeyDown', ev, props); } }