Closed Bug 1523627 Opened 5 years ago Closed 5 years ago

picture <source> element doesn't select the right source when in Angular app

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox67 --- fixed

People

(Reporter: rechdshraipfelehr, Assigned: emilio)

Details

Attachments

(2 files)

I've created an empty, new Angular app with the example of the <picture>-Tag from https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture

The content of app.component.html is

<picture>
  <source srcset="https://interactive-examples.mdn.mozilla.net/media/examples/surfer-240-200.jpg"
          media="(min-width: 800px)">
  <img src="https://interactive-examples.mdn.mozilla.net/media/examples/painted-hand-298-332.jpg" />
</picture>

The image should change when the browser is smaller than 800px but it doesn't in Firefox 65 while it works in other browsers.

Live example: https://angular-bxhc7x.stackblitz.io/
Live example source code: https://stackblitz.com/edit/angular-bxhc7x

It's very similar to bug 1518795 so I guess it has to do with shadow dom.

Let's see if Emilio has thoughts here. :)

Flags: needinfo?(emilio)
Priority: -- → P3

This is not using Shadow DOM, nor seems a regression (it's broken in 60 as well at least). Also, we get the image wrong even if we load the page with a small viewport to begin with.

I can take a look though.

I don't see a reason for it not to select the right source.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: picture <source> element doesn't dynamically react to media changes in Angular app → picture <source> element doesn't select the right source when in Angular app
Attached file Reduced test-case.
Flags: needinfo?(emilio)
Assignee: nobody → emilio

Thanks for the report! The patch above should fix it :)

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/84a4caccdc97
HTMLSourceElement should keep track of its media list even if there's no image next-sibling yet. r=jdm
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/15225 for changes under testing/web-platform/tests
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: