Quick Tags, Quick Reblog: Fix popup horizontal cutoff #1536
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.
Description
Right now, it's possible for Quick Tags/Quick Reblog popups to extend past the left or right of their post elements (fundamentally fine) and be clipped off by the edge of the viewport or post column (not fine) in various circumstances. This fixes this by:
A simpler option, of course, would be to keep the popup horizontally within the post (
const preventOverflowTarget = target.closest(postSelector)
). When the viewport is wide enough not to need this I think it feels a bit more natural to leave it centered, but the difference is very small.Another option, essentially the opposite, would be to target the viewport (adjusting position only on phone screens) and properly float the popups above e.g. the Patio column edges. I'm not sure if there's an elegant way to do this (
HTMLDialogElement
'sshowModal()
, maybe?)Incidental changes:
closest('div')
apparently now matches a "root"div class="v2JIl"
element in <990px viewports that I don't think existed when we wrote the 12px override thingy.Resolves #1369. Fixes mobile-device issue reported in the New XKit Discord that hasn't been made into an issue yet.
Testing steps
todo: write full list of tests performed. (patio narrow column, peepr wide, peepr narrow, embedded blog view, tablet/mobile layout, narrow phone layout via browser zoom /// top/bottom positions)