Make WordPress Core

Opened 7 years ago

Last modified 7 years ago

#42695 new defect (bug)

Text Widget: hard-coded width/height attributes are stripped from iframes

Reported by: dubaicarmelschool's profile dubaicarmelschool Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.9
Component: Widgets Keywords: has-patch dev-feedback
Focuses: Cc:

Description

hi when i update my WordPress 4.9 my exiting iframe size in text widget not working.please find my http://dubaicarmelschool.com/ and iframe code below:
<iframe src="sshow/show.html" border="0" width="700" height="400"style="border: 0; margin-left: -120px; margin-right: -0px; margin-top: -9px; margin-bottom: -0px;"></iframe>

Attachments (2)

Untitled.jpg (53.6 KB) - added by dubaicarmelschool 7 years ago.
text widget iframe output
42695.diff (1.2 KB) - added by audrasjb 7 years ago.
Avoid to strip dimensions from iframes in text widget embed logic

Download all attachments as: .zip

Change History (23)

@dubaicarmelschool
7 years ago

text widget iframe output

#1 @westonruter
7 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 4.9.2

The width and height are getting removed for the sake of getting embeds to resize properly. See [42001] and #42203.

I can see that this logic needs to be prevented for any elements that are hard-coded with dimensions. We need to limit the replacements to iframes and other media that come from external embeds

@dubaicarmelschool in the immediate term, please add your iframe code to a Custom HTML widget instead. This will bypass the stripping of the width and height attributes.

#2 @westonruter
7 years ago

  • Summary changed from Text in Widget to Text Widget: hard-coded width/height attributes are stripped from iframes

#3 @westonruter
7 years ago

The approach we take in a patch could be to replace all width/height attributes with placeholders prior to doing embeds, and then restore them after the embeds are done.

#4 @programmin
7 years ago

The same thing happens whenever you paste a Google Calendar code into the code, eg.

<iframe src="thecalendar.google.comURL" style="border: 0" width="100%" height="600" frameborder="0" scrolling="no"></iframe>

Height is removed, iframe is not very big, as in that screenshot.

This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.


7 years ago

#6 @westonruter
7 years ago

I think what should be done is the following: any heights or widths in the original text should get replaced with placeholders before running the embed logic. Then after embedding logic is done, and the dimensions are stripped out, the placeholders can be swapped back with their original values. This will ensure any user-supplied dimensions are kept intact.

#7 @dd32
7 years ago

  • Milestone changed from 4.9.2 to 4.9.3

Bumping to 4.9.3 due to 4.9.2s release

#8 @programmin
7 years ago

I'm surprised there was no mention of using HEIGHT="NUMBER" in capitals to make the Wordpress match and replace not take away all the height. I would think this should be a top, bolded item in the release notes for wp4.9 - if you have iframe that you still want to have height, make sure you edit it and CAPITALIZE height after upgrading.

This ticket was mentioned in Slack in #core by desrosj. View the logs.


7 years ago

#10 @desrosj
7 years ago

  • Milestone changed from 4.9.3 to 4.9.4

Punting to 4.9.4.

#11 @programmin
7 years ago

At the very least shouldn't the release notes say users need to capitalize HEIGHT in iframes if they want to actually see it all?

#12 @dd32
7 years ago

  • Milestone changed from 4.9.4 to 4.9.5

Bumping, 4.9.4 has been released.

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


7 years ago

#14 @audrasjb
7 years ago

  • Keywords has-patch dev-feedback added; needs-patch removed

Hi @westonruter

I tried a workaround for this ticket in 42695.diff.
This patch clearly needs dev-feedback.

Cheers,
Jb

Last edited 7 years ago by audrasjb (previous) (diff)

@audrasjb
7 years ago

Avoid to strip dimensions from iframes in text widget embed logic

This ticket was mentioned in Slack in #core by audrasjb. View the logs.


7 years ago

#16 @audrasjb
7 years ago

  • Milestone changed from 4.9.5 to 4.9.6

Bumping to 4.9.6 due to 4.9.5 beta release.

This ticket was mentioned in Slack in #core by desrosj. View the logs.


7 years ago

This ticket was mentioned in Slack in #core by desrosj. View the logs.


7 years ago

This ticket was mentioned in Slack in #core by desrosj. View the logs.


7 years ago

#20 @westonruter
7 years ago

  • Milestone changed from 4.9.6 to Future Release

#21 @programmin
7 years ago

Not seeing any mention of this in https://codex.wordpress.org/Version_4.9

If this is not changing there should be a note that every widget with an iframe tag should have capitalized height= if you want it to actually have height.

Note: See TracTickets for help on using tickets.