diff --git a/packages/next/client/future/image.tsx b/packages/next/client/future/image.tsx index 57e07805dd5f..ae2bee4f4359 100644 --- a/packages/next/client/future/image.tsx +++ b/packages/next/client/future/image.tsx @@ -576,6 +576,10 @@ export default function Image({ position: 'absolute', height: '100%', width: '100%', + left: 0, + top: 0, + right: 0, + bottom: 0, } : {}, showAltText || placeholder === 'blur' ? {} : { color: 'transparent' }, diff --git a/test/integration/image-future/default/test/index.test.js b/test/integration/image-future/default/test/index.test.js index 1a9715f4f40c..95570ddbd14c 100644 --- a/test/integration/image-future/default/test/index.test.js +++ b/test/integration/image-future/default/test/index.test.js @@ -992,6 +992,15 @@ function runTests(mode) { ) ).toBe('100%') }) + it('should add position styles to fill images', async () => { + expect( + await browser.eval( + `document.getElementById("fill-image-1").getAttribute('style')` + ) + ).toBe( + 'position:absolute;height:100%;width:100%;left:0;top:0;right:0;bottom:0;color:transparent' + ) + }) if (mode === 'dev') { it('should not log incorrect warnings', async () => { await waitFor(1000)