Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n-input-number not focused properly when tabbed into #244

Closed
prazdevs opened this issue Jun 22, 2021 · 3 comments · Fixed by #259
Closed

n-input-number not focused properly when tabbed into #244

prazdevs opened this issue Jun 22, 2021 · 3 comments · Fixed by #259

Comments

@prazdevs
Copy link

TuSimple/naive-ui version (版本)

2.13.0

Vue version (Vue 版本)

3.1.1

Browser and its version (浏览器及其版本)

Chrome(91.0.4472.114)

System and its version (系统及其版本)

Windows10(20H2)

Node version (Node 版本)

16.2.0

Reappearance link (重现链接)

https://codesandbox.io/s/naive-uin-input-numberfocus-bug-9783q?file=/src/App.vue

Reappearance steps (重现步骤)

  1. Click first input.
  2. Tab into second input.
  3. Value can be changed with arrow keys but you cannot type directly.

Expected results (期望的结果)

We should be able to type the number directly as well as changing the value with arrow keys when focus comes from tabbing.

Actual results (实际的结果)

If the input is focused by tabbing, you cannot type numbers, but you can only change the value by using arrow keys.

Remarks (补充说明)

this causes accessibility and keyboard navigation issues

@prazdevs prazdevs changed the title n-input-number not focused properly when tabbed into n-input-number not focused properly when tabbed into Jun 22, 2021
@prazdevs
Copy link
Author

prazdevs commented Jun 22, 2021

I looked into the code a bit, and i think it comes from n-input prop passively-activated and activateddata making the underlying input field unfocusable in favor of the n-input component itself.
The activated data gets set to true when the field is clicked on (and we have the expected behaviour), but not when it's tabbed into.

@XieZongChen XieZongChen added the bug Something isn't working label Jun 22, 2021
@prazdevs
Copy link
Author

prazdevs commented Jun 22, 2021

Removing the passively-activated prop from n-input gives me the expected behaviour, but i don't get the idea behind this prop. Tests don't break, but idk if some specific behaviour might break.

edit: i found out that you need to press enter to "enter edit mode", but from an accessibility point of view, this is definitely not a good practice.

@07akioni
Copy link
Collaborator

Removing the passively-activated prop from n-input gives me the expected behaviour, but i don't get the idea behind this prop. Tests don't break, but idk if some specific behaviour might break.

edit: i found out that you need to press enter to "enter edit mode", but from an accessibility point of view, this is definitely not a good practice.

The idea is that I want make select cascader or date-picker and ... components to have a consistent behavior. However this is an early decision. Maybe later we will change the way.

What you said is right. It doesn't make a lot sense to make it passively activated.

@07akioni 07akioni added consideration-needed and removed bug Something isn't working labels Jun 22, 2021
07akioni added a commit that referenced this issue Jun 23, 2021
- Fix `n-input-number` lacks `on-update-value` prop.
- Fix `n-input-number`'s value can't be null.
- Fix `n-input-number`'s button doesn't work after value is cleared, closes [#251](#251).
- `n-input-number` will focus directly, closes [#244](#244).
07akioni added a commit that referenced this issue Jun 23, 2021
* fix(input-number): many fixes

- Fix `n-input-number` lacks `on-update-value` prop.
- Fix `n-input-number`'s value can't be null.
- Fix `n-input-number`'s button doesn't work after value is cleared, closes [#251](#251).
- `n-input-number` will focus directly, closes [#244](#244).

* docs(input-number): fixes

* docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants