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

Add a way to keepfocus when using the invalidate API #2865

Closed
pzuraq opened this issue Nov 22, 2021 · 1 comment · Fixed by #2883
Closed

Add a way to keepfocus when using the invalidate API #2865

pzuraq opened this issue Nov 22, 2021 · 1 comment · Fixed by #2883
Labels

Comments

@pzuraq
Copy link
Contributor

pzuraq commented Nov 22, 2021

Describe the problem

I may have missed it, but it doesn't seem like there is a way currently to use the invalidate API and keep focus on the currently active element. We oftentimes use the invalidate API in order to poll our data for updates, and as this is essentially a background task it shouldn't really interrupt the user's current action (e.g. typing in a form field). Currently we're working around this by refocusing the element after all invalidate promises have resolved, but this feels like a bit of a hack.

Describe the proposed solution

Allow options to be passed to invalidate as the second parameter, with keepfocus being the first supported option:

invalidate('api.example.com', { keepfocus: true });

Alternatives considered

No response

Importance

would make my life easier

Additional Information

Multiple invalidates can run for a single transition, so it's kind of hard to know what to do if the options for each invalidate conflict.

@bluwy
Copy link
Member

bluwy commented Nov 23, 2021

Does this only happen recently? I think #2819 might've accidentally caused this.

@benmccann Come to think of it, maybe the initial way was intended after all, I don't think we would want to handle hash, scroll, keepfocus for invalidate. Should we revert that and document it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants