Fix survol container getting out of height (issue #96)#146
Conversation
mdolr
left a comment
There was a problem hiding this comment.
- Fixed height doesn't feel right
- If you want the container to appear asynchronously, add it through the templates, as right now, when you stop your cursor on a link, you expect it to show a preview, but even though the content is loaded the container hasn't been updated so it doesn't show anything which feels really weird
|
Hey @mdolr! Just addressing your two comments:
|
|
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). |
|
Hi @mdolr: Noted. I just made a new commit with the following changes based on your comments:
I still left the Looking forward to your feedback. |
|
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: 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? |
|
Because of the max-height the preview's footer disappears |
|
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. |

Changes made:
js/base.jsinnerHTMLcontent doesn't load yet when hovering on a link, the popup height and width are both 0 (this was why the popup would initially appear below the mouse when it should appear above the mouse). I enforced a default value of 320px for each to set an initial popup position so this wouldn't happen.topPositioncalculation so that if the mouse is in the bottom half of the screen, then the popup will appear above the mouse, otherwise it will appear below the mousepopupHeightis initially null and can thus affect placement of the popup above or below the mouse)css/base.cssoverflow: hiddenrule to truncate popup's contents that may exceed the max height