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

Make a function that abstracts our querySelector logic #359

Open
sraby opened this issue Jul 29, 2020 · 1 comment
Open

Make a function that abstracts our querySelector logic #359

sraby opened this issue Jul 29, 2020 · 1 comment

Comments

@sraby
Copy link
Member

sraby commented Jul 29, 2020

In our DetailView component we use the document.querySelector() function to scroll to the top of the wrapper div. This usage created some problems when we converted to typescript as we then needed to check for the existence of such a HTML element before calling .scrollTop on it. @toolness suggested that we could actually make a helper function that repeats this logic in a more abstract way so we can use it around our codebase.

@toolness
Copy link
Contributor

Roight, there is actually such a helper in @justfixnyc/util actually! https://github.com/JustFixNYC/justfix-ts/blob/master/packages/util/get-html-element.ts

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

No branches or pull requests

2 participants