Skip to content

Commit

Permalink
feat: n-select, n-tree-select, n-cascader pressing arrow down can ope…
Browse files Browse the repository at this point in the history
…n menu, ref #300
  • Loading branch information
07akioni committed Jul 25, 2021
1 parent 7b7877b commit a78c6de
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- `n-time-picker` add `actions` prop, closes [#401](https://github.com/TuSimple/naive-ui/issues/401).
- `n-switch` add `checked`, `unchecked` slots.
- `n-switch` add `loading` prop, closes [#301](https://github.com/TuSimple/naive-ui/issues/301).
- `n-select` pressing arrow down can open menu, ref [#300](https://github.com/TuSimple/naive-ui/issues/300)
- `n-tree-select` pressing arrow down can open menu, ref [#300](https://github.com/TuSimple/naive-ui/issues/300)
- `n-cascader` pressing arrow down can open menu, ref [#300](https://github.com/TuSimple/naive-ui/issues/300)

### Fixes

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- `n-time-picker` 增加 `actions` 属性, 关闭 [#401](https://github.com/TuSimple/naive-ui/issues/401)
- `n-switch` 增加 `checked``unchecked` 插槽
- `n-switch` 增加 `loading` 属性,关闭 [#301](https://github.com/TuSimple/naive-ui/issues/301)
- `n-select` 按下箭头会打开菜单,有关 [#300](https://github.com/TuSimple/naive-ui/issues/300)
- `n-tree-select` 按下箭头会打开菜单,有关 [#300](https://github.com/TuSimple/naive-ui/issues/300)
- `n-cascader` 按下箭头会打开菜单,有关 [#300](https://github.com/TuSimple/naive-ui/issues/300)

### Fixes

Expand Down
2 changes: 2 additions & 0 deletions src/cascader/src/Cascader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,8 @@ export default defineComponent({
} else {
move('next')
}
} else {
openMenu()
}
break
case 'ArrowLeft':
Expand Down
2 changes: 2 additions & 0 deletions src/select/src/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,8 @@ export default defineComponent({
if (props.loading) return
if (mergedShowRef.value) {
menuRef.value?.next()
} else {
openMenu()
}
break
case 'Escape':
Expand Down
6 changes: 5 additions & 1 deletion src/tree-select/src/TreeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,11 @@ export default defineComponent({
closeMenu()
focusSelection()
} else {
treeHandleKeyup(e)
if (mergedShowRef.value) {
treeHandleKeyup(e)
} else if (e.code === 'ArrowDown') {
openMenu()
}
}
}
function treeHandleKeyup (e: KeyboardEvent): void {
Expand Down

0 comments on commit a78c6de

Please sign in to comment.