Dogusata/fix content left shift when width set to 0 temporarily #105
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
This PR resolves two issues:
1. Shifted chat contents
When you close and reopen Q panel, the contents of the active Q tab shifts to left and exceeds the left edge of the panel.
Reproduction
2. Tooltips remain on screen
When you suddenly close the Q panel while a tooltip/link preview is active and visible, when you open it back it remains on screen.
Reproduction
Solution!
The left shift issue is caused by the width value of the html/body/main-wrapper when the Q panel is closed on VSCode since VSCode make the extensions invisible by also setting their size to 0. When the panel opens back again, the mis-calculation of the size causes the contents (mainly on flex boxes) shift to left. So we need to ensure that both body and the main wrapper has a measured width (px, em, rem, vw etc.). In addition to that, we need to make it recalculated with the width change on main wrapper.
min-width
andmin-height
to thebody
if it is theroot
wrapper for mynah-uiroot
wrapper sizingflexbox
toblock
.@container
check to turn everything's visibility off when the width is 0 (which will trigger a proper re-render when the width comes back)For the remaining preview tooltips, when the panel is suddenly closed, the expected
mouseleave
andmouseout
events are not being fired. Since we're also handling the element visibility with @container check now, it also removes the remaining preview tooltips as well. Which cannot be reappear unless the user hovers to the same thing again.License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.