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

Avoid puck blocking part of the popup #1833

Open
StarScape opened this issue Jun 20, 2024 · 5 comments
Open

Avoid puck blocking part of the popup #1833

StarScape opened this issue Jun 20, 2024 · 5 comments

Comments

@StarScape
Copy link
Contributor

StarScape commented Jun 20, 2024

A negative downside of #1773 is that occasionally you run into a situation where you do a lookup, and if the word/kanji entry is big, the popup window will expand and the puck will be covering a portion of it. Like this:

image

Before, you could just drag the puck out of the way. But now if you do that the event listener will detect that the puck is inside the 10ten popup and cause it to disappear.

My first thought was that the easy way to prevent this would be to just give the puck a lower z-index than the popup window. Not sure if there is any conceivable downside to that. Thoughts?

@birtles
Copy link
Member

birtles commented Jun 22, 2024

My first thought was that the easy way to prevent this would be to just give the puck a lower z-index than the popup window. Not sure if there is any conceivable downside to that. Thoughts?

Good question. It looks like we deliberately make the puck sit above the popup:

/*
* Use the same z-index as the popup. This is the empirical maximum value. Because
* we ensure the popup appears before the puck in the DOM, even though we use
* the same z-index, the puck should appear on top.
*/
z-index: 2147483647;

If we made the popup cover the puck, would that be annoying? For example, you're scanning some text and it generates a massive popup which happens to cover the puck. Now you have to stop moving the puck, close the popup, and then start scanning again?

@StarScape
Copy link
Contributor Author

Yeah, that’s a good point, I could see it interfering with scanning, which would be annoying. I think this might go back to the idea I discussed in #1767 of never letting the popup spawn too close to the puck in the first place.

For now, I think I’ll make a branch with the puck z-index dropped, run that locally for a few days, and see if it causes issues.

@birtles
Copy link
Member

birtles commented Jun 24, 2024

For now, I think I’ll make a branch with the puck z-index dropped, run that locally for a few days, and see if it causes issues.

Sounds great.

I wonder if we will end up needing to do something complicated like dismissing the popup when the "moon" (smaller dot) passes over the popup and the "earth" (larger dot) is not over the popup or something like that.

@StarScape
Copy link
Contributor Author

I've been busy with interview-related stuff the past week so have been slow to follow up on this, but I got some time to play around with it this morning. Some notes:

If we made the popup cover the puck, would that be annoying? For example, you're scanning some text and it generates a massive popup which happens to cover the puck. Now you have to stop moving the puck, close the popup, and then start scanning again?

This does happen from time to time with the z-index of the puck dropped. I could never get it to happen on initial lookup, i.e. in the Word tab, so thankfully it doesn't seem to interfere with scanning. But sometimes when I flip over to the Kanji or Names tabs the puck will be covered, and I'll have to close the popup and start over again.

I think this might still be better than the current behavior, where the puck can cover part of the popup, with no way to fix it, since moving the puck causes the popup itself to disappear. However, I think we can still come up with a better solution.

I wonder if we will end up needing to do something complicated like dismissing the popup when the "moon" (smaller dot) passes over the popup and the "earth" (larger dot) is not over the popup or something like that.

I'm intrigued by this idea. I might hack this together on my machine and give it a shot.

@birtles
Copy link
Member

birtles commented Jul 11, 2024

I've been busy with interview-related stuff the past week so have been slow to follow up on this, but I got some time to play around with it this morning.

Great, thank you!

If we made the popup cover the puck, would that be annoying? For example, you're scanning some text and it generates a massive popup which happens to cover the puck. Now you have to stop moving the puck, close the popup, and then start scanning again?

This does happen from time to time with the z-index of the puck dropped. I could never get it to happen on initial lookup, i.e. in the Word tab, so thankfully it doesn't seem to interfere with scanning.

That's curious that it never happens on initial look up. I wonder why?

I wonder if we will end up needing to do something complicated like dismissing the popup when the "moon" (smaller dot) passes over the popup and the "earth" (larger dot) is not over the popup or something like that.

I'm intrigued by this idea. I might hack this together on my machine and give it a shot.

That would be great. Thank you!

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