-
Notifications
You must be signed in to change notification settings - Fork 0
feat(search-input): add onFocus #241
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
ef126aa
to
a9df0af
Compare
a9df0af
to
518187c
Compare
@@ -194,6 +198,7 @@ export const SearchInput: VoidFunctionComponent<SearchInputProps> = ({ | |||
autoComplete="on" | |||
disabled={disabled} | |||
onChange={handleChange} | |||
onClick={onClick} |
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.
C'est quoi le use case pour avoir besoin du click sur le input? C'est rarement un event qu'on met sur un 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.
C'est pour ouvrir un dropdown quand la personne clique le input avant de saisir du texte car le dropdown contient un historique des recherches précédentes.
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.
Dans ce cas c'est plus onFocus
que tu as besoin probablement? Aussi, ce serait bien d'être plus spécifique. Quelque chose comme onInputFocus
?
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.
Je suis d'accord avec @meriouma , le onClick
peut porter à confusion avec le search-button dans SearchContextual
.
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.
J'ajouterais ce test dans search-input.test.tsx
et ce serait all good.
it('should call onClick when input is clicked', () => {
const onClick = jest.fn();
const wrapper = shallow(
<SearchInput onClick={onClick} />,
);
getByTestId(wrapper, 'search-input').simulate('click');
expect(onClick).toHaveBeenCalledTimes(1);
});
9fe203e
to
36f924d
Compare
@@ -130,6 +131,8 @@ export interface CommonSearchProps { | |||
|
|||
onReset?(): void; | |||
|
|||
onFocus?(event: FocusEvent<HTMLInputElement>): void; |
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.
Ça devrait être onInputFocus
car ça peut porter à confusion avec le focus du bouton.
Avant de merger il faudrait cleaner les commits et changer le titre de la PR. Pour sauver des étapes tu peux seulement changer le titre de la PR et faire un |
PR Description
...
GitHub issues resolved by PR
...
Bug fix checklist
New component checklist
storybook
package.