Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CoCo_Code_Op2
next.js
提交
081c1a17
N
next.js
项目概览
CoCo_Code_Op2
/
next.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
next.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
081c1a17
编写于
5月 03, 2020
作者:
J
Joe Haddad
提交者:
GitHub
5月 03, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Fast Refresh] Unlock Focus on Disabled Element (#12425)
上级
92ad5c0b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
1 deletion
+27
-1
packages/react-dev-overlay/src/internal/components/LeftRightDialogHeader/LeftRightDialogHeader.tsx
...omponents/LeftRightDialogHeader/LeftRightDialogHeader.tsx
+26
-0
packages/react-dev-overlay/src/internal/components/LeftRightDialogHeader/styles.ts
...y/src/internal/components/LeftRightDialogHeader/styles.ts
+1
-1
未找到文件。
packages/react-dev-overlay/src/internal/components/LeftRightDialogHeader/LeftRightDialogHeader.tsx
浏览文件 @
081c1a17
...
...
@@ -74,12 +74,37 @@ const LeftRightDialogHeader: React.FC<LeftRightDialogHeaderProps> = function Lef
}
},
[
close
,
nav
,
next
,
previous
])
// Unlock focus for browsers like Firefox, that break all user focus if the
// currently focused item becomes disabled.
React
.
useEffect
(()
=>
{
if
(
nav
==
null
)
{
return
}
const
root
=
nav
.
getRootNode
()
// Always true, but we do this for TypeScript:
if
(
root
instanceof
ShadowRoot
)
{
const
a
=
root
.
activeElement
if
(
previous
==
null
)
{
if
(
a
===
buttonLeft
.
current
)
{
buttonLeft
.
current
.
blur
()
}
}
else
if
(
next
==
null
)
{
if
(
a
===
buttonRight
.
current
)
{
buttonRight
.
current
.
blur
()
}
}
}
},
[
nav
,
next
,
previous
])
return
(
<
div
data
-
nextjs
-
dialog
-
left
-
right
className
=
{
className
}
>
<
nav
ref
=
{
onNav
}
>
<
button
ref
=
{
buttonLeft
}
type
=
"button"
disabled
=
{
previous
==
null
?
true
:
undefined
}
aria
-
disabled
=
{
previous
==
null
?
true
:
undefined
}
onClick
=
{
previous
??
undefined
}
>
...
...
@@ -88,6 +113,7 @@ const LeftRightDialogHeader: React.FC<LeftRightDialogHeaderProps> = function Lef
<
button
ref
=
{
buttonRight
}
type
=
"button"
disabled
=
{
next
==
null
?
true
:
undefined
}
aria
-
disabled
=
{
next
==
null
?
true
:
undefined
}
onClick
=
{
next
??
undefined
}
>
...
...
packages/react-dev-overlay/src/internal/components/LeftRightDialogHeader/styles.ts
浏览文件 @
081c1a17
...
...
@@ -21,7 +21,7 @@ const styles = css`
[data-nextjs-dialog-left-right] > nav > button:hover {
background-color: rgba(230, 0, 0, 0.2);
}
[data-nextjs-dialog-left-right] > nav > button
[aria-disabled]
{
[data-nextjs-dialog-left-right] > nav > button
:disabled
{
background-color: rgba(230, 0, 0, 0.1);
color: rgba(230, 0, 0, 0.2);
cursor: not-allowed;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录