-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FE] NumberKeyboardBottomSheet 영역에서 스크롤이 가능한 문제 #633
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생했습니다~~ 점점 완성도 높은 프로그램이 되어가는 것 같아요
z-index: 20; | ||
touch-action: none; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
touch action을 막아주신 코드인거죠?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
맞숨당~
}; | ||
|
||
if (isOpened) { | ||
document.addEventListener('touchmove', preventScroll, {passive: false}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
passive false는 어떤 의미인가요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
passive 리스너는 preventDefault를 호출하지 않는 역할을 합니다~
touchMove event는 기본적으로 passive event 인데,
우리는 preventDefault를 호출하기 때문에 passive:false 를 통해서 preventDefault를 사용한다고 알려줘야합니당~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굳굳쓰입니댜 ~!
@@ -26,6 +31,8 @@ const NumberKeyboardBottomSheet = ({isOpened, onClose, ...props}: Props) => { | |||
gap: 1rem; | |||
bottom: 0; | |||
background-color: ${theme.colors.white}; | |||
z-index: 20; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
나아..중에,, 제가 만들어 둔 z-index token을 사용해야 겠군여
const bottomSheet = bottomSheetRef.current; | ||
if (!bottomSheet) return; | ||
|
||
const preventScroll = (e: TouchEvent) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굳굳쓰 ~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
멋집니다!! 이런 오류를 발견하다니......
}; | ||
|
||
if (isOpened) { | ||
document.addEventListener('touchmove', preventScroll, {passive: false}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
touchMove라는 이벤트가 있었구뇽..!! 덕분에 알게됐어요 😆👍
const useNumberKeyboardBottomSheet = ({isOpened}: Props) => { | ||
const bottomSheetRef = useRef<HTMLDivElement>(null); | ||
|
||
useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이건 굳이 싶을 수도 있긴한데요.! usePreventTouchMove라는 유틸함수 또는 훅으로 분리해서 사용할 수도 있을 것 같아요! 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 그것도 좋은 방법이라고 생각합니다. touch를 막는 부분이 또 필요하다면 분리해보도록 할게요!
issue
구현 목적
2024-09-25.1.37.00.mov
NumberKeyboardBottomSheet가 올라온 경우 해당 영역을 드래그 해도 스크롤이 가능한 문제가 있습니다.
이 경우 사용자가 의도하지 않은 대로 동작할 수 있고, 안좋은 유저 경험의 원인이 될 수 있다고 생각합니다.
구현 사항