Unverified Commit b60985b2 authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Revert "fix(Link): Set focus back to the body element (#7693)" (#7753)

This reverts commit defde85e.
parent defde85e
...@@ -180,16 +180,7 @@ class Link extends Component<LinkProps> { ...@@ -180,16 +180,7 @@ class Link extends Component<LinkProps> {
if (!success) return if (!success) return
if (scroll) { if (scroll) {
window.scrollTo(0, 0) window.scrollTo(0, 0)
// set focus back to the body element document.body.focus()
const activeElement = document.activeElement as HTMLElement
const bodyElement = document.querySelector('body')
if (
activeElement &&
activeElement !== bodyElement &&
activeElement.blur
) {
activeElement.blur()
}
} }
}) })
.catch((err: any) => { .catch((err: any) => {
......
...@@ -74,20 +74,6 @@ describe('Client Navigation', () => { ...@@ -74,20 +74,6 @@ describe('Client Navigation', () => {
await browser.close() await browser.close()
}) })
it('should set focus back to body after navigating', async () => {
const browser = await webdriver(context.appPort, '/nav')
await browser
.elementByCss('#about-link')
.click()
.waitForElementByCss('.nav-about')
const result = await browser.eval(
`document.activeElement === document.querySelector('body')`
)
expect(result).toBe(true)
})
it('should navigate via the client side', async () => { it('should navigate via the client side', async () => {
const browser = await webdriver(context.appPort, '/nav') const browser = await webdriver(context.appPort, '/nav')
......
...@@ -254,20 +254,6 @@ describe('Production Usage', () => { ...@@ -254,20 +254,6 @@ describe('Production Usage', () => {
expect(newText).toBe('server') expect(newText).toBe('server')
}) })
it('should set focus back to body after navigating', async () => {
const browser = await webdriver(context.appPort, '/')
await browser
.elementByCss('a')
.click()
.waitForElementByCss('.about-page')
const result = await browser.eval(
`document.activeElement === document.querySelector('body')`
)
expect(result).toBe(true)
})
it('should change query correctly', async () => { it('should change query correctly', async () => {
const browser = await webdriver(appPort, '/query?id=0') const browser = await webdriver(appPort, '/query?id=0')
let id = await browser.elementByCss('#q0').text() let id = await browser.elementByCss('#q0').text()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment