Skip to content

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

Merged
merged 6 commits into from
Apr 26, 2021
Merged

Conversation

Valentin-Lachere
Copy link
Contributor

PR Description

...

GitHub issues resolved by PR

...

Bug fix checklist

  • Units tests have been adjusted to account for bug.
  • The fix has been tested in multiple Storybook stories.
  • All GitHub checks are successful.

New component checklist

  • The new component and its tests are in the same component folder.
  • The component is unit tested and/or snapshot tested.
  • All of the relevant Storybook stories have been added to the storybook package.
  • There are no linting errors or warnings in the modified/new code.
  • All GitHub checks are successful.

@Valentin-Lachere Valentin-Lachere changed the title add onclick to search input feat(search-input): add onclick Apr 22, 2021
@Valentin-Lachere Valentin-Lachere force-pushed the dev/add-onClick-input branch 2 times, most recently from ef126aa to a9df0af Compare April 22, 2021 21:06
@@ -194,6 +198,7 @@ export const SearchInput: VoidFunctionComponent<SearchInputProps> = ({
autoComplete="on"
disabled={disabled}
onChange={handleChange}
onClick={onClick}
Copy link
Contributor

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 🤔

Copy link
Contributor Author

@Valentin-Lachere Valentin-Lachere Apr 23, 2021

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.

Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor

@maxime-gendron maxime-gendron left a 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);
        });

@@ -130,6 +131,8 @@ export interface CommonSearchProps {

onReset?(): void;

onFocus?(event: FocusEvent<HTMLInputElement>): void;
Copy link
Contributor

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.

@maxime-gendron
Copy link
Contributor

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 squash and merge. Ça va faire un merge commit avec le titre de la PR comme commit message.

@Valentin-Lachere Valentin-Lachere changed the title feat(search-input): add onclick feat(search-input): add onFocus Apr 26, 2021
@Valentin-Lachere Valentin-Lachere merged commit 87dd87b into master Apr 26, 2021
@Valentin-Lachere Valentin-Lachere deleted the dev/add-onClick-input branch April 26, 2021 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants