Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
b60985b2
Unverified
Commit
b60985b2
authored
Jul 05, 2019
by
Joe Haddad
Committed by
GitHub
Jul 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "fix(Link): Set focus back to the body element (#7693)" (#7753)
This reverts commit
defde85e
.
parent
defde85e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1 addition
and
38 deletions
+1
-38
link.tsx
packages/next/client/link.tsx
+1
-10
index.test.js
test/integration/client-navigation/test/index.test.js
+0
-14
index.test.js
test/integration/production/test/index.test.js
+0
-14
No files found.
packages/next/client/link.tsx
View file @
b60985b2
...
@@ -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
)
=>
{
...
...
test/integration/client-navigation/test/index.test.js
View file @
b60985b2
...
@@ -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'
)
...
...
test/integration/production/test/index.test.js
View file @
b60985b2
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment