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

Unlogical editor navigation with shift+tab in DataTable #843

Closed
TonisPiip opened this issue Apr 14, 2019 · 6 comments
Closed

Unlogical editor navigation with shift+tab in DataTable #843

TonisPiip opened this issue Apr 14, 2019 · 6 comments
Assignees
Labels
Type: Bug Issue contains a defect related to a specific component.
Milestone

Comments

@TonisPiip
Copy link
Contributor

TonisPiip commented Apr 14, 2019

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://forum.primefaces.org/viewforum.php?f=57

Bug:
Editor doesn't move in logcal way when using SHIFT + TAB when editing a cell in a data table.

Reproduction:
https://www.primefaces.org/primereact/#/datatable/edit
Click a cell
press tab N times to move editor forward N times.
Press Shift+tab M times, editor is opened at - N -M places from current editor. (Ie one back from initial opening of the editor)
Press 'tab' again, editor moves to N+1 from initial editor location. (Ie skipping n+M cells from current edior location)

Expected results:
Editor always moves +1 or -1 from current editor position.

Tested with:
FireFox
Chromium

React version:
Version currently on is being run on primefaces.org and my local env: 16.0.0
PrimeReact version:
Version currently on is being run on primefaces.org and my local env: 2.0.0-rc.1

@sylven32
Copy link

sylven32 commented May 6, 2019

Reproduced with https://www.primefaces.org/primereact/#/datatable/edit
-> an editable cell already visited with tab/shift+tab keys cannot be visited again the same way; only a mouse click will switch it to editor mode

Looking at https://github.com/primefaces/primereact/blob/master/src/components/datatable/BodyCell.js, line 118, a change from:
this.keyHelper.removeAttribute('tabindex');
to:
this.keyHelper.setAttribute('tabindex', '0');
would allow expected behavior, at least on Firefox and Chrome. Edge has other issues on blur of the focusable input...

@TonisPiip
Copy link
Contributor Author

Kind of fixes the issue, but there are still some minor bugs with it.
I have selection mode enabled and if I tab into a new row, and then open a new editing cell, then tab, the editor for the next cell over from the tab-navigated cell opens.

Likely the tab-index has to be removed on blur somewhere, or that on-editing needs to explicitly focus on something.

Thanks for the help.

@TonisPiip
Copy link
Contributor Author

Seems that the issue might be caused by too quickly switching and navigating with tab.

@TonisPiip
Copy link
Contributor Author

Found another bug, seems that sometimes the editor gets stuck when using shift-tab when using some editors. It updates a few times, and ends up with the 0 index when it is editing. because the timeout overrides the -1.

Solution is to run this.tabIndex_timeout && clearTimeout(this.tabIndex_timeout); at the start of that method and assign the timeout to tabindex_timeout.

How likely would it be for them to accept a pull request or do I need to work off my own fork now?

@sylven32
Copy link

They seem to accept some PR but we'd better hear from them before spending more time on this.

Someone from the team, what's your position regarding above proposal? Many thanks for your help.

@TonisPiip
Copy link
Contributor Author

Sent their support address an email. We'll see what comes of it.

I plan to make a fork anyway as the inline editor doesn't have any onCancelEditing or onAcceptEditing callback props. So I guess I'll submit a PR and then we'll know if they accept or not.

TonisPiip added a commit to lino-framework/primereact that referenced this issue May 15, 2019
@cagataycivici cagataycivici self-assigned this May 22, 2019
@cagataycivici cagataycivici added the Type: Bug Issue contains a defect related to a specific component. label May 22, 2019
@cagataycivici cagataycivici added this to the 3.1.4 milestone May 22, 2019
cagataycivici added a commit that referenced this issue May 30, 2019
Fixed #843 by restoring tabindex when tabing out of editor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a defect related to a specific component.
Projects
None yet
Development

No branches or pull requests

3 participants