-
Notifications
You must be signed in to change notification settings - Fork 321
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
feat: add autoFocus to CheckBox #2059
feat: add autoFocus to CheckBox #2059
Conversation
@@ -122,7 +134,8 @@ describe("Checkbox tests", () => { | |||
option1Value, | |||
checkbox1Name, | |||
checkbox2Name, | |||
checkbox3Name | |||
checkbox3Name, | |||
defaultChecked: true |
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.
What is this?
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.
In the existing tests, the tests had defaultChecked set to true, I needed it to be false in my tests so I can check the autoFocus so I added this as optional
@@ -39,6 +40,8 @@ type RenderHelper = { | |||
option3Text: string; | |||
option3Value: string; | |||
onChangeMock3: jest.MockedFunction<MockedFunction>; | |||
defaultChecked?: boolean; | |||
autoFocusOption2?: boolean; |
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.
autoFocusOption2 ? :)
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.
:D, I can send just autoFocus and put it on the first option but I'm not sure it will be clear from outside.. WDYT?
packages/core/src/components/Checkbox/__tests__/checkbox-tests.jest.tsx
Outdated
Show resolved
Hide resolved
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.
Seems cool. let's just remove the extra duplicated tests (unless there's a reason they're there, waiting for your reply)
packages/core/src/components/Checkbox/__tests__/checkbox-tests.jest.tsx
Outdated
Show resolved
Hide resolved
….jest.tsx Co-authored-by: Yossi Saadi <[email protected]>
In the new hard signup we want to autofocus the first option for each question in order to support accessibility and voice reading in the future: see -> task item
So for this reason, I added autoFocus prop to CheckBox