-
Notifications
You must be signed in to change notification settings - Fork 0
[URH-22] useOutsideInteraction 신규 #22
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
Conversation
…eact-hooks into URH-22/useOutsideInteraction
(event: Event) => { | ||
if (event instanceof KeyboardEvent) { | ||
if (event.key === 'Escape') { | ||
handleOutsideInteraction(); |
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.
[P2] esc 키를 누르는 상황과 ref 영역 외부를 클릭하는 상황을 분리하는 건 어떨까요?
사용자 입장에서 생각해 볼 때 esc 키를 눌렀다는 건 '아무것도 하지 않겠다'는 의도에 좀 더 가깝다고 생각하는데 그 때 이벤트가 발생하면 버그처럼 느껴질 수도 있지 않을까요?🤔
아래 예시처럼 스타일로 ref를 숨겨볼 수도 있을 것 같습니다!
ref.current.style.visibility = "hidden";
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.
저는 esc가 escape인 만큼 현재상황을 빠져나간다는 느낌으로 받아들여져서 괜찮은 것 같다고 생각합니다. 대신 문서에 keydown 및 escape키의 작동 여부를 확실히 명시해두면 좋을 것 같네요
덧붙이자면 keyboard이벤트 관련해서 분리하는 것도 나쁘지 않을 것 같습니다...너무 한정된 단위(키 하나)라 고민되긴 하네요
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.
오 이렇게 훅 하나 추가...?!😎
소현 님 말씀도 일리가 있어서 해당 부분은 지예 님이 판단하셔서 좋은 방향으로 반영하면 좋을 것 같아요!
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.
고생하셨습니다👍 해당 코드를 보다보니 덕분에 ref를 저장할때 어떤 방법을 쓸지 다시한번 고민해보게 되었네요
👾 Pull Request
1️⃣ Spec
2️⃣ 변경 사항
3️⃣ 예시 코드
4️⃣ 관련 문서 (선택 사항)