Unified Doc Viewer push flyout touchups #20
Merged
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.
Summary
This PR includes a few minor touchups for the Unified Doc Viewer push flyout.
I noticed that when the window is slightly smaller, but not small enough to switch to the overlay flyout, expanding the push flyout can cause the Discover layout to become very squished and start breaking:
squished.mp4
I also found that when the push flyout is expanded and I resized the screen, it would overflow the window when I resized it small enough that the flyout switched to an overlay. TBH this feels like an EUI bug to me, but I think we can work around it for now and file an issue to see if EUI is willing to change the behaviour:
overflow.mp4
IMO the right longer term solution to the layout squishing issue is probably to do similar to what we've done with the flyout table and actions, and make the layout responsive based on container size instead of window size, but this would involve a number of changes across Discover and Unified Search, so probably best to save that for a followup. In the meantime, when the screen is large enough for the push flyout, I added a max width to the flyout that leaves enough room that the Discover layout doesn't break too much. Similarly, we can address the flyout overflow issue by applying a max width to the flyout when in overlay mode so it can take up most but not all of the available screen space (same approach EUI uses for the flyout on mobile):
squished_overflow_fixed.mp4
The other thing I noticed was that when in mobile mode, the actions popover isn't aligned with the actual button because of the flex group/item around it. The close button also becomes centered within the flyout footer due to the flex group/item around it:
I addressed the popover issue by just switching the flex group to a
div
, which fixes the alignment and preserves the responsiveness. For the close button, it looks like we can just drop the flex group entirely and it will remain aligned to the left: