mdolr / survol

A browser extension to preview any link you hover
https://survol.me
Apache License 2.0
143 stars 67 forks source link

Fix survol container getting out of height (issue #96) #146

Open rezziemaven opened 4 years ago

rezziemaven commented 4 years ago

Changes made:

rezziemaven commented 4 years ago

Hey @mdolr! Just addressing your two comments:

  1. I thought it would be good to enforce a min-height because when I use an initial height value and then in some cases when the content has a height that's actually less than that, it changes the positioning of the popup above/ below the mouse when the mouse moves again, which to me from a user perspective doesn't seem like expected behaviour. But otherwise if the height of the content is actually larger than the min-height it will extend the height of the popup but up to half the height of the entire screen (which I thought would be a good way to ensure that the popup stays within the visible portion of the screen). However, if you'd still like me to remove the fixed height then I'll update it.

  2. I agree that this isn't expected behaviour. Would you prefer that it at least shows a blank popup which is then filled with content when it's successfully loaded? I was thinking it could perhaps show some indication that the content was loading in a similar way to how the iPhone previews content in a box when you deep press on a link, and shows a progress bar indicating that the content is loading. However, I know that might need to be a separate issue and outside the scope of this one. Otherwise, yes I can try to handle this in the templates so that the box is the correct size upon hover and mouse move over the link to be previewed.

mdolr commented 4 years ago

I think the problem was more about the preview getting out of the screen when the content is too long and not about the preview being displayed under the cursor and then updated above the cursor (which should also be fixed but is less important honestly).

rezziemaven commented 4 years ago

Hi @mdolr:

Noted. I just made a new commit with the following changes based on your comments:

I still left the max-height style property to ensure that the popup stays within the visible part of the screen, to address your requirement that the content doesn't get to be too long. However, the addition of conditionally setting a top or bottom style property ensures that the popup displays above the cursor when in the lower half of the screen, or below the cursor when in the upper part of the screen. This is because it only relies on the cursor height and not the height of the popup which isn't initially known.

Looking forward to your feedback.

mdolr commented 4 years ago

This completely breaks preview for links like : This one or This one

rezziemaven commented 4 years ago

Hi @mdolr,

Apologies for the delay. Could you be more specific as to how it's breaking the preview for stackoverflow links? As in what would you prefer to be the expected behaviour just so I can better understand?

Embedding a GIF to show you what I see when I hover over the links you shared: Screen Recording 2020-10-27 at 11 30 20 PM

Do you mean because I set a max-height for the popup or, with the example of the second one, the last line is clipped at the bottom of the popup?

mdolr commented 4 years ago

Because of the max-height the preview's footer disappears

rezziemaven commented 4 years ago

Thank you for the explanation; apologies for not noticing. I propose the following:

In general though, would you prefer I increase the max-height I set to the popup? My reasoning for making the max-height half of the screen height was so that in that way, the popup would always be visible on the screen.

Regardless, I look forward to hearing your recommendations that would help this PR to be approved.