Firefox does not respect the width set on a fieldset when inner content is larger than it. So having max-width: 100% does not work on images and such.

Replacing the fieldset with a normal div makes everything work just fine.
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | panopoly_test-preview-fieldset-2467073-16.patch | 570 bytes | cboyden |
| #17 | interdiff-15-16.txt | 593 bytes | cboyden |
| #14 | panopoly-reusable-multi-preview.png | 324.34 KB | cboyden |
| #14 | panopoly-reusable-single-preview.png | 186.8 KB | cboyden |
| #14 | panopoly-large-image-preview.png | 552.96 KB | cboyden |
Comments
Comment #1
segovia94 commentedHere is a followup issue in Firefox.
https://bugzilla.mozilla.org/show_bug.cgi?id=504622
Here is a codepen illustrating things.
http://codepen.io/segovia94/pen/pvmOMN
Comment #2
dsnopekThanks for reporting this and doing the research! Looks like there are a couple workarounds in the Firefox bug you link to, so that should provide a place to start when creating a patch to fix this.
Comment #3
segovia94 commentedTrying to add
display: table-cell;doesn't work with thefloat: right;. If you remove the float then everything is fine. Of course, that doesn't really help. Moving the float and 48% width to the wrapping div works, but I'm not sure how easy it would be to target it since it's just an empty div.Comment #4
segovia94 commentedThis seems to be working initially.
Comment #5
segovia94 commented#4 causes the max-height to be ignored which means the preview window could grow to be really tall.
Comment #6
dsnopekWhat about setting a 'height' rather than 'max-height'?
Comment #7
segovia94 commentedHeight was ignored also.
Comment #8
segovia94 commentedI've been trying to fix this lately with Flexbox, but the
<fieldset>element still has the same issues. Is anyone against removing the use of the<fieldset>for the preview container and instead using a<div>or some other html5 element like a<section>. It wouldn't be difficult to style it the same, and<fieldset>is semantically incorrect anyway since it has nothing to do with form elements.Comment #9
dsnopekI'd be fine with that!
One thing to note, this will probably conflict with the patch here which is almost finished:
#2155377: Only show one widget preview at a time when adding content in panels
Ideally, it'd be good to keep in mind how the two sets of changes will merge..
Comment #10
dsnopekThis issue will be much easier to implement once #2496027: Generate preview markup in a theme function/template is fixed!
Comment #11
dsnopekHere's a first pass at this!
This has been trickier to get right than I thought it would be. The CSS still isn't quite right, and is doing some weird things when hovering over the "Add" button for example, so it not only needs more work from me, but could also use some extensive testing and review.
Comment #12
dsnopekHere's a new version that fixes the issues with the "Add" button. It's a little strange because the previous CSS was a one-to-one conversion changing 'legend' to '.panopoly-magic-preview-title-wrapper', so you'd think it would work, but instead using '.panopoly-magic-preview-title-inner' gets the desired effect.
I haven't been able to find any other issues with the styling! More testing and review is welcome. :-)
Comment #13
dsnopekHere's an issue to make corresponding changes in Radix: #2688455: Don't use <fieldset> in Panopoly preview
Comment #14
cboyden commentedThis looks good on Responsive Bartik. Screenshots were taken on Firefox 45/Mac OSX 10.11.3.
Preview of Add Text widget with a 1024px wide image:

Adding the reusable widget in Single Preview mode:

Adding a reusable widget in Automatic Preview mode, with one 640px wide image and one 1024px wide image:

Comment #15
cboyden commentedBehat tests relying on live preview will fail because the region definition needs to change. I've attached a patch for panopoly_test that updates behat.common.yml.
Comment #16
cboyden commentedHm, the previous patch will cause upgrade tests to fail. New patch has a less-specific Live Preview region definition.
Comment #17
cboyden commentedPrevious comment had incorrect patch and interdiff.
Comment #18
dsnopekAfter fixing #2688644: Pin to Drush 8 so we can keep testing with PHP 5.4, this appears to be working on Travis-CI:
https://travis-ci.org/panopoly/panopoly/builds/116469778
Just waiting for the update build to finish and hopefully it'll pass too. :-)
Comment #20
dsnopekTests passed! Committed. :-) Thanks @cboyden and @segovia94!