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

Zaps not registered on first click if modal was closed before #771

Closed
ekzyis opened this issue Jan 30, 2024 · 2 comments
Closed

Zaps not registered on first click if modal was closed before #771

ekzyis opened this issue Jan 30, 2024 · 2 comments

Comments

@ekzyis
Copy link
Member

ekzyis commented Jan 30, 2024

Description

The first short press on a zap icon is not registered if a modal was closed before.

Steps to Reproduce

  1. Open modal
  2. Close modal
  3. Click zap icon -> Zap not registered
  4. Click zap icon again -> Zap registered

Expected behavior

Zaps are always registered

Video

2024-01-30.02-43-51.mp4

Additional context

I thought it might be related to the document losing focus on modal open and the modal not giving back focus to the document, but document.activeElement returned the same before and after a modal was closed.

Also, if you add onClick to a parent element (see video), it does get registered. So I think it's something wrong with LongPressable and not related to missing focus. Using raw HTML works as expected.

I think this was always the case but it annoyed me enough while working on #749 to create a ticket now for this and I found easy steps to reproduce now.

@ekzyis ekzyis added the bug label Jan 30, 2024
@huumn
Copy link
Member

huumn commented Jan 30, 2024

Can confirm this has been a bug since we added LongPressable

jp30566347 added a commit to jp30566347/stacker.news that referenced this issue Apr 11, 2024
 - Extract handlers
 - Remove unnecessary async keyword from callback
 - Assign a new key to force remounting of LongPressable component when modal is closed from long press
 - Remove hover state when closing modal, otherwise it stays colored
@jp30566347
Copy link
Contributor

This is a hard one. Couldn't find a root cause, but have a workaround.

huumn pushed a commit that referenced this issue Apr 12, 2024
* Fix first zap when modal closed (#771)

 - Extract handlers
 - Remove unnecessary async keyword from callback
 - Assign a new key to force remounting of LongPressable component when modal is closed from long press
 - Remove hover state when closing modal, otherwise it stays colored

* Replace LongPressable with custom component

* Remove yarn.lock
@huumn huumn closed this as completed Apr 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants