Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
掘金者说
vscode
提交
bb94a5b5
V
vscode
项目概览
掘金者说
/
vscode
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vscode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
bb94a5b5
编写于
1月 28, 2016
作者:
B
Benjamin Pasero
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve quick open accessibility (fixes #2393)
上级
ab5dce24
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
22 addition
and
44 deletion
+22
-44
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
+22
-44
未找到文件。
src/vs/base/parts/quickopen/browser/quickOpenWidget.ts
浏览文件 @
bb94a5b5
...
@@ -80,6 +80,8 @@ export class QuickOpenWidget implements IModelProvider {
...
@@ -80,6 +80,8 @@ export class QuickOpenWidget implements IModelProvider {
private
currentInputToken
:
string
;
private
currentInputToken
:
string
;
private
quickNavigateConfiguration
:
IQuickNavigateConfiguration
;
private
quickNavigateConfiguration
:
IQuickNavigateConfiguration
;
private
container
:
HTMLElement
;
private
container
:
HTMLElement
;
private
treeElement
:
HTMLElement
;
private
inputElement
:
HTMLElement
;
private
usageLogger
:
IQuickOpenUsageLogger
;
private
usageLogger
:
IQuickOpenUsageLogger
;
private
layoutDimensions
:
Dimension
;
private
layoutDimensions
:
Dimension
;
private
model
:
IModel
<
any
>
;
private
model
:
IModel
<
any
>
;
...
@@ -126,8 +128,15 @@ export class QuickOpenWidget implements IModelProvider {
...
@@ -126,8 +128,15 @@ export class QuickOpenWidget implements IModelProvider {
this
.
inputContainer
=
inputContainer
;
this
.
inputContainer
=
inputContainer
;
this
.
inputBox
=
new
InputBox
(
inputContainer
.
getHTMLElement
(),
null
,
{
this
.
inputBox
=
new
InputBox
(
inputContainer
.
getHTMLElement
(),
null
,
{
placeholder
:
this
.
options
.
inputPlaceHolder
||
''
,
placeholder
:
this
.
options
.
inputPlaceHolder
||
''
,
ariaLabel
:
nls
.
localize
(
'
quickOpenAriaLabel
'
,
"
Type to narrow down results, then press Tab to jump into the result list and make a pick
.
"
)
ariaLabel
:
nls
.
localize
(
'
quickOpenAriaLabel
'
,
"
Quick picker. Type to narrow down results
.
"
)
});
});
// ARIA
this
.
inputElement
=
this
.
inputBox
.
inputElement
;
this
.
inputElement
.
setAttribute
(
'
role
'
,
'
combobox
'
);
this
.
inputElement
.
setAttribute
(
'
aria-haspopup
'
,
'
false
'
);
this
.
inputElement
.
setAttribute
(
'
aria-autocomplete
'
,
'
list
'
);
DOM
.
addDisposableListener
(
this
.
inputBox
.
inputElement
,
DOM
.
EventType
.
KEY_DOWN
,
(
e
:
KeyboardEvent
)
=>
{
DOM
.
addDisposableListener
(
this
.
inputBox
.
inputElement
,
DOM
.
EventType
.
KEY_DOWN
,
(
e
:
KeyboardEvent
)
=>
{
let
keyboardEvent
:
StandardKeyboardEvent
=
new
StandardKeyboardEvent
(
e
);
let
keyboardEvent
:
StandardKeyboardEvent
=
new
StandardKeyboardEvent
(
e
);
...
@@ -182,6 +191,8 @@ export class QuickOpenWidget implements IModelProvider {
...
@@ -182,6 +191,8 @@ export class QuickOpenWidget implements IModelProvider {
ariaLabel
:
nls
.
localize
(
'
treeAriaLabel
'
,
"
Quick Picker
"
)
ariaLabel
:
nls
.
localize
(
'
treeAriaLabel
'
,
"
Quick Picker
"
)
});
});
this
.
treeElement
=
this
.
tree
.
getHTMLElement
();
// Handle Focus and Selection event
// Handle Focus and Selection event
this
.
toUnbind
.
push
(
this
.
tree
.
addListener
(
EventType
.
FOCUS
,
(
event
:
IFocusEvent
)
=>
{
this
.
toUnbind
.
push
(
this
.
tree
.
addListener
(
EventType
.
FOCUS
,
(
event
:
IFocusEvent
)
=>
{
this
.
elementFocused
(
event
.
focus
,
event
);
this
.
elementFocused
(
event
.
focus
,
event
);
...
@@ -367,54 +378,14 @@ export class QuickOpenWidget implements IModelProvider {
...
@@ -367,54 +378,14 @@ export class QuickOpenWidget implements IModelProvider {
}
}
}
}
/*private cycleThroughEntryGroups(entries:QuickOpenEntry[], focus:QuickOpenEntry, isShift:boolean):void {
// Return early if no entries present
if (entries.length === 0) {
return;
}
// Focus next/previous group if possible
let index = focus ? entries.indexOf(focus) : -1; // TODO@Ben should not make ordering assumptions
if (index >= 0) {
if (!isShift) {
for (let i = index + 1; i < entries.length; i++) {
let nextGroupEntry = entries[i];
if (nextGroupEntry instanceof QuickOpenEntryGroup && (<QuickOpenEntryGroup>nextGroupEntry).getGroupLabel()) {
this.tree.setFocus(nextGroupEntry);
return;
}
}
} else {
for (let i = index - 1; i >= 0; i--) {
if (entries[i] instanceof QuickOpenEntryGroup && (<QuickOpenEntryGroup>entries[i]).getGroupLabel()) {
this.tree.setFocus(entries[i]);
return;
}
}
}
}
// Focus first group unless shift is pressed
if (!isShift) {
this.tree.setFocus(entries[0]);
return;
}
// Focus last group entry otherwise
for (let i = entries.length - 1; i >= 0; i--) {
if (entries[i] instanceof QuickOpenEntryGroup && (<QuickOpenEntryGroup>entries[i]).getGroupLabel()) {
this.tree.setFocus(entries[i]);
return;
}
}
}*/
private
elementFocused
(
value
:
any
,
event
?:
any
):
void
{
private
elementFocused
(
value
:
any
,
event
?:
any
):
void
{
if
(
!
value
||
!
this
.
isVisible
())
{
if
(
!
value
||
!
this
.
isVisible
())
{
return
;
return
;
}
}
// ARIA
this
.
inputElement
.
setAttribute
(
'
aria-activedescendant
'
,
this
.
treeElement
.
getAttribute
(
'
aria-activedescendant
'
));
const
context
:
IContext
=
{
event
:
event
,
quickNavigateConfiguration
:
this
.
quickNavigateConfiguration
};
const
context
:
IContext
=
{
event
:
event
,
quickNavigateConfiguration
:
this
.
quickNavigateConfiguration
};
this
.
model
.
runner
.
run
(
value
,
Mode
.
PREVIEW
,
context
);
this
.
model
.
runner
.
run
(
value
,
Mode
.
PREVIEW
,
context
);
}
}
...
@@ -514,6 +485,10 @@ export class QuickOpenWidget implements IModelProvider {
...
@@ -514,6 +485,10 @@ export class QuickOpenWidget implements IModelProvider {
if
(
this
.
currentInputToken
===
currentInputToken
)
{
if
(
this
.
currentInputToken
===
currentInputToken
)
{
this
.
tree
.
setInput
(
null
).
then
(()
=>
{
this
.
tree
.
setInput
(
null
).
then
(()
=>
{
this
.
model
=
input
;
this
.
model
=
input
;
// ARIA
this
.
inputElement
.
setAttribute
(
'
aria-haspopup
'
,
String
(
input
&&
input
.
entries
&&
input
.
entries
.
length
>
0
));
return
this
.
tree
.
setInput
(
input
);
return
this
.
tree
.
setInput
(
input
);
}).
done
(()
=>
{
}).
done
(()
=>
{
// Indicate entries to tree
// Indicate entries to tree
...
@@ -701,6 +676,9 @@ export class QuickOpenWidget implements IModelProvider {
...
@@ -701,6 +676,9 @@ export class QuickOpenWidget implements IModelProvider {
this
.
inputBox
.
value
=
''
;
this
.
inputBox
.
value
=
''
;
this
.
tree
.
setInput
(
null
);
this
.
tree
.
setInput
(
null
);
// ARIA
this
.
inputElement
.
setAttribute
(
'
aria-haspopup
'
,
'
false
'
);
// Reset Tree Height
// Reset Tree Height
this
.
treeContainer
.
style
({
height
:
(
this
.
options
.
minItemsToShow
?
this
.
options
.
minItemsToShow
*
22
:
0
)
+
'
px
'
});
this
.
treeContainer
.
style
({
height
:
(
this
.
options
.
minItemsToShow
?
this
.
options
.
minItemsToShow
*
22
:
0
)
+
'
px
'
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录