Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
vscode
提交
618dbf47
V
vscode
项目概览
xxadev
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
618dbf47
编写于
1月 04, 2017
作者:
J
João Moreno
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
improve list accessibility
fixes #17113
上级
c0cfb1a6
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
9 deletion
+29
-9
src/vs/base/browser/ui/list/listPaging.ts
src/vs/base/browser/ui/list/listPaging.ts
+4
-3
src/vs/base/browser/ui/list/listWidget.ts
src/vs/base/browser/ui/list/listWidget.ts
+17
-3
src/vs/workbench/parts/extensions/browser/extensionsList.ts
src/vs/workbench/parts/extensions/browser/extensionsList.ts
+4
-1
src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts
...ch/parts/extensions/electron-browser/extensionsViewlet.ts
+4
-2
未找到文件。
src/vs/base/browser/ui/list/listPaging.ts
浏览文件 @
618dbf47
...
...
@@ -7,7 +7,7 @@ import 'vs/css!./list';
import
{
IDisposable
}
from
'
vs/base/common/lifecycle
'
;
import
{
range
}
from
'
vs/base/common/arrays
'
;
import
{
IDelegate
,
IRenderer
,
IFocusChangeEvent
,
ISelectionChangeEvent
}
from
'
./list
'
;
import
{
List
}
from
'
./listWidget
'
;
import
{
List
,
IListOptions
}
from
'
./listWidget
'
;
import
{
IPagedModel
}
from
'
vs/base/common/paging
'
;
import
Event
,
{
mapEvent
}
from
'
vs/base/common/event
'
;
...
...
@@ -67,10 +67,11 @@ export class PagedList<T> {
constructor
(
container
:
HTMLElement
,
delegate
:
IDelegate
<
number
>
,
renderers
:
IPagedRenderer
<
T
,
any
>
[]
renderers
:
IPagedRenderer
<
T
,
any
>
[],
options
:
IListOptions
=
{}
)
{
const
pagedRenderers
=
renderers
.
map
(
r
=>
new
PagedRenderer
<
T
,
ITemplateData
<
T
>>
(
r
,
()
=>
this
.
model
));
this
.
list
=
new
List
(
container
,
delegate
,
pagedRenderers
);
this
.
list
=
new
List
(
container
,
delegate
,
pagedRenderers
,
options
);
}
get
onFocusChange
():
Event
<
IFocusChangeEvent
<
T
>>
{
...
...
src/vs/base/browser/ui/list/listWidget.ts
浏览文件 @
618dbf47
...
...
@@ -116,7 +116,7 @@ class FocusTrait<T> extends Trait<T> {
renderElement
(
element
:
T
,
index
:
number
,
container
:
HTMLElement
):
void
{
super
.
renderElement
(
element
,
index
,
container
);
container
.
setAttribute
(
'
role
'
,
'
option
'
);
container
.
setAttribute
(
'
role
'
,
'
treeitem
'
);
container
.
setAttribute
(
'
id
'
,
this
.
getElementId
(
index
));
}
}
...
...
@@ -201,6 +201,7 @@ class Controller<T> implements IDisposable {
}
export
interface
IListOptions
extends
IListViewOptions
{
ariaLabel
?:
string
;
}
const
DefaultOptions
:
IListOptions
=
{};
...
...
@@ -245,13 +246,17 @@ export class List<T> implements IDisposable {
});
this
.
view
=
new
ListView
(
container
,
delegate
,
renderers
,
options
);
this
.
view
.
domNode
.
setAttribute
(
'
role
'
,
'
listbox
'
);
this
.
view
.
domNode
.
setAttribute
(
'
role
'
,
'
tree
'
);
this
.
view
.
domNode
.
tabIndex
=
0
;
this
.
controller
=
new
Controller
(
this
,
this
.
view
);
this
.
disposables
=
[
this
.
focus
,
this
.
selection
,
this
.
view
,
this
.
controller
];
this
.
_onDOMFocus
=
domEvent
(
this
.
view
.
domNode
,
'
focus
'
);
this
.
onFocusChange
(
this
.
_onFocusChange
,
this
,
this
.
disposables
);
if
(
options
.
ariaLabel
)
{
this
.
view
.
domNode
.
setAttribute
(
'
aria-label
'
,
options
.
ariaLabel
);
}
}
splice
(
start
:
number
,
deleteCount
:
number
,
...
elements
:
T
[]):
void
{
...
...
@@ -418,7 +423,16 @@ export class List<T> implements IDisposable {
}
private
_onFocusChange
():
void
{
DOM
.
toggleClass
(
this
.
view
.
domNode
,
'
element-focused
'
,
this
.
focus
.
get
().
length
>
0
);
const
focus
=
this
.
focus
.
get
();
if
(
focus
.
length
>
0
)
{
this
.
view
.
domNode
.
setAttribute
(
'
aria-activedescendant
'
,
this
.
getElementId
(
focus
[
0
]));
}
else
{
this
.
view
.
domNode
.
removeAttribute
(
'
aria-activedescendant
'
);
}
this
.
view
.
domNode
.
setAttribute
(
'
role
'
,
'
tree
'
);
DOM
.
toggleClass
(
this
.
view
.
domNode
,
'
element-focused
'
,
focus
.
length
>
0
);
}
dispose
():
void
{
...
...
src/vs/workbench/parts/extensions/browser/extensionsList.ts
浏览文件 @
618dbf47
...
...
@@ -23,6 +23,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
import
{
IExtensionService
}
from
'
vs/platform/extensions/common/extensions
'
;
export
interface
ITemplateData
{
root
:
HTMLElement
;
element
:
HTMLElement
;
icon
:
HTMLImageElement
;
name
:
HTMLElement
;
...
...
@@ -92,7 +93,7 @@ export class Renderer implements IPagedRenderer<IExtension, ITemplateData> {
const
disposables
=
[
versionWidget
,
installCountWidget
,
ratingsWidget
,
builtinStatusAction
,
updateAction
,
reloadAction
,
manageAction
,
actionbar
];
return
{
element
,
icon
,
name
,
installCount
,
ratings
,
author
,
description
,
disposables
,
root
,
element
,
icon
,
name
,
installCount
,
ratings
,
author
,
description
,
disposables
,
extensionDisposables
:
[],
set
extension
(
extension
:
IExtension
)
{
versionWidget
.
extension
=
extension
;
...
...
@@ -110,6 +111,7 @@ export class Renderer implements IPagedRenderer<IExtension, ITemplateData> {
renderPlaceholder
(
index
:
number
,
data
:
ITemplateData
):
void
{
addClass
(
data
.
element
,
'
loading
'
);
data
.
root
.
removeAttribute
(
'
aria-label
'
);
data
.
extensionDisposables
=
dispose
(
data
.
extensionDisposables
);
data
.
icon
.
src
=
''
;
data
.
name
.
textContent
=
''
;
...
...
@@ -142,6 +144,7 @@ export class Renderer implements IPagedRenderer<IExtension, ITemplateData> {
data
.
icon
.
style
.
visibility
=
'
inherit
'
;
}
data
.
root
.
setAttribute
(
'
aria-label
'
,
extension
.
displayName
);
data
.
name
.
textContent
=
extension
.
displayName
;
data
.
author
.
textContent
=
extension
.
publisherDisplayName
;
data
.
description
.
textContent
=
extension
.
description
;
...
...
src/vs/workbench/parts/extensions/electron-browser/extensionsViewlet.ts
浏览文件 @
618dbf47
...
...
@@ -102,7 +102,9 @@ export class ExtensionsViewlet extends Viewlet implements IExtensionsViewlet {
const
delegate
=
new
Delegate
();
const
renderer
=
this
.
instantiationService
.
createInstance
(
Renderer
);
this
.
list
=
new
PagedList
(
this
.
extensionsBox
,
delegate
,
[
renderer
]);
this
.
list
=
new
PagedList
(
this
.
extensionsBox
,
delegate
,
[
renderer
],
{
ariaLabel
:
localize
(
'
extensions
'
,
"
Extensions
"
)
});
const
onKeyDown
=
chain
(
domEvent
(
this
.
searchBox
,
'
keydown
'
))
.
map
(
e
=>
new
StandardKeyboardEvent
(
e
));
...
...
@@ -434,7 +436,7 @@ export class StatusUpdater implements IWorkbenchContribution {
private
onServiceChange
():
void
{
if
(
this
.
extensionsWorkbenchService
.
local
.
some
(
e
=>
e
.
state
===
ExtensionState
.
Installing
))
{
this
.
activityBarService
.
showActivity
(
VIEWLET_ID
,
new
ProgressBadge
(()
=>
localize
(
'
extensions
'
,
'
Extensions
'
)),
'
extensions-badge progress-badge
'
);
this
.
activityBarService
.
showActivity
(
VIEWLET_ID
,
new
ProgressBadge
(()
=>
localize
(
'
extensions
'
,
"
Extensions
"
)),
'
extensions-badge progress-badge
'
);
return
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录