Skip to content

Commit b66c1d6

Browse files
authored
Remove layout-router sticky/fixed debug warning (#85193)
Fixes an issue that reproduces due to a combination of the log forwarding logic alongside logging out an explicit element. We can add this back in the future once our log forwarding library properly ignores non-enumerable properties.
1 parent 96754b6 commit b66c1d6

File tree

2 files changed

+0
-34
lines changed

2 files changed

+0
-34
lines changed

packages/next/src/client/components/layout-router.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,6 @@ function shouldSkipElement(element: HTMLElement) {
140140
// and will result in a situation we bail on scroll because of something like a fixed nav,
141141
// even though the actual page content is offscreen
142142
if (['sticky', 'fixed'].includes(getComputedStyle(element).position)) {
143-
if (process.env.NODE_ENV === 'development') {
144-
console.warn(
145-
'Skipping auto-scroll behavior due to `position: sticky` or `position: fixed` on element:',
146-
element
147-
)
148-
}
149143
return true
150144
}
151145

test/e2e/app-dir/router-autoscroll/router-autoscroll.test.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -197,20 +197,6 @@ describe('router autoscrolling on navigation', () => {
197197
.click()
198198
.waitForElementByCss('#content-that-is-visible')
199199
await check(() => browser.eval('window.scrollY'), 0)
200-
201-
if (isNextDev) {
202-
// Check that we've logged a warning
203-
await check(async () => {
204-
const logs = await browser.log()
205-
return logs.some((log) =>
206-
log.message.includes(
207-
'Skipping auto-scroll behavior due to `position: sticky` or `position: fixed` on element:'
208-
)
209-
)
210-
? 'success'
211-
: undefined
212-
}, 'success')
213-
}
214200
})
215201

216202
it('Should scroll to the top of the layout when the first child is position sticky', async () => {
@@ -221,20 +207,6 @@ describe('router autoscrolling on navigation', () => {
221207
.click()
222208
.waitForElementByCss('#content-that-is-visible')
223209
await check(() => browser.eval('window.scrollY'), 0)
224-
225-
if (isNextDev) {
226-
// Check that we've logged a warning
227-
await check(async () => {
228-
const logs = await browser.log()
229-
return logs.some((log) =>
230-
log.message.includes(
231-
'Skipping auto-scroll behavior due to `position: sticky` or `position: fixed` on element:'
232-
)
233-
)
234-
? 'success'
235-
: undefined
236-
}, 'success')
237-
}
238210
})
239211

240212
it('Should apply scroll when loading.js is used', async () => {

0 commit comments

Comments
 (0)