-
Notifications
You must be signed in to change notification settings - Fork 49
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
Add handlers for composition on Inputs #1082
Add handlers for composition on Inputs #1082
Conversation
🦋 Changeset detectedLatest commit: 461a50a The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
77201d6
to
ce7498c
Compare
…vent handler manually
- this hook wrap keyboard event handlers to lock while composing
…ion from safari event check - add comments about safari event check
…ef with nativeEvent.isComposing So we don't have to put composition event handlers into our inputs
ce7498c
to
63073db
Compare
Codecov ReportBase: 72.07% // Head: 72.14% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## next-v1 #1082 +/- ##
===========================================
+ Coverage 72.07% 72.14% +0.07%
===========================================
Files 223 225 +2
Lines 3051 3070 +19
Branches 840 845 +5
===========================================
+ Hits 2199 2215 +16
Misses 728 728
- Partials 124 127 +3
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Chromatic Report🚀 Congratulations! Your build was successful! |
.changeset/lovely-planets-yawn.md
Outdated
"@channel.io/bezier-react": minor | ||
--- | ||
|
||
keyboard event locker added to inputs |
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.
체인지로그를 더 자세히 적어주셔도 좋을 거 같아요. Composing 중 common ime control keys에 대해 keyboard event handler가 호출되지 않아야한다.
라는 내용이 포함되면 좋겠습니다. (영문)
@@ -184,6 +185,34 @@ describe('TextArea 테스트 >', () => { | |||
expect(textareaElement.selectionEnd).toEqual(TEST_INITIAL_VALUE.length) | |||
}) | |||
}) | |||
|
|||
describe('Composing 중 common ime control keys에 대해 keyboard event handler가 호출되지 않아야한다. >', () => { |
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.
영문으로 작성해주세요!
const input = rendered.getElementsByTagName('input')[0] | ||
|
||
COMMON_IME_CONTROL_KEYS.forEach(async (key) => { | ||
const isCompositionStartFired = fireEvent.compositionStart(input) |
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.
fireEvent
대신 userEvent
를 통해 테스트 가능할까요? (관련 링크)
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.
userEvent에서는 composition을 mocking할 수 있는 방법을 따로 지원하지 않습니다 😢
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.
저는 여전히 해당 훅을 베지어에서 지원해줘야 하는 지에 대한 의문이 있긴 합니다. 또한 크로스브라우징을 지원해주는 것과는 별개로, 특정 브라우저 여부를 디자인 시스템에서 알고 어떤 로직을 실행하는것에 컨선이 있기도 합니다.
베지어 컴포넌트와 깊은 연관성이 있지는 않아보이기도 해서, 베지어 컴포넌트는 이를 받을 수 있는 인터페이스만 열어주고, 어플리케이션 레벨에서 처리되어야 하는 일이 아닐까..? 하는 의문이 들어용! 다른 디자인 시스템은 어떻게 처리하고 있는지 궁금하네요.
@CHEWCHEWW 이 기능을 제공하느냐는 편의 vs 유연함 사이에서의 선택이라고 생각합니다.
|
다른 라이브러리에서는 composition을 어떻게 처리하나에 대한 레퍼런스입니다.
|
This reverts commit 89f1883.
Self Checklist
CODEOWNERS
file.Related Issue
Fixes #977
Summary
Details
useKeyboardActionLockerWhileComposing 훅을 작성합니다.
일본어 문자 입력
KeyDown 이벤트 발생 => composition 전이므로 핸들러 실행
CompositionStart 이벤트 발생 => 지금부터는 composing 상태
KeyUp 이벤트 발생 => composition 중이므로 핸들러 실행X
...
IME control key 입력(예를 들어 tab)
KeyDown 이벤트 발생 => composition 중이므로 핸들러 실행X
KeyUp 이벤트 발생 => composition 중이므로 핸들러 실행X
...
Composition을 종료시키는 IME control key 입력(예를 들어 enter, escape)
KeyDown 이벤트 발생 => composition 중이므로 핸들러 실행X
CompositionEnd 이벤트 발생 => composition 종료
KeyUp 이벤트 발생 => composition이 끝났으므로 핸들러 실행
TextField와 TextArea에 useKeyboardActionLockerWhileComposing 훅을 적용합니다.
Breaking change or not (Yes/No)
References