Skip to content
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

fix(searchBox): autofocus input when modal opens #121

Merged
merged 1 commit into from
May 11, 2020

Conversation

francoischalifour
Copy link
Member

Since we switched from React to Preact, the app lost the "autofocus" feature on the input when the modal opens.

This happens because Preact follows the HTML spec of triggering the autofocus on page load, and not when the component mounts. React is more aggressive about this behavior.

This therefore gets rid of the autoFocus prop which is ignored here, and focuses the input with an effect.

Closes #119.

Since we switched from React to Preact, the app lost the "autofocus" feature on the input when the modal opens.

This happens because [Preact follows the HTML spec](preactjs/preact#1255 (comment)) of triggering the autofocus on page load, and not when the component mounts. React is more "aggressive" on this behavior.

This therefore gets rid of the `autoFocus` prop which is ignored here, and focuses the input with an effect.

Closes #119.
@francoischalifour francoischalifour merged commit 09f1856 into next May 11, 2020
@francoischalifour francoischalifour deleted the fix/searchbox-autofocus branch May 11, 2020 09:24
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.

None yet

2 participants