fixed-data-table-2 icon indicating copy to clipboard operation
fixed-data-table-2 copied to clipboard

Support tabbing through inputs in grid

Open wcjordan opened this issue 8 years ago • 7 comments

Expected Behavior

Tabbing through inputs scrolls grid

Current Behavior

Tabbing through input breaks layout because the row scrolls, but not the scroller See #149 for original filing & existing work around.

Possible Solution

  • Capture any tab on an input bubbling up to the FDT component and prevent default on it.
  • Query to get all tab-able inputs in grid (see Know which elements are tab-able here).
  • Sort by tab order (tabIndex, position in DOM).
  • Find the next element following event.target.
  • Determine the row & column for that element and scroll to said row & column using scrollToColumn & scrollToRow functionality.
  • Focus the next element.

POC: https://jsfiddle.net/y27o89s6/4/

Steps to Reproduce (for bugs)

https://jsfiddle.net/y27o89s6/1/

Context

Support for grid with inputs you can tab between

Your Environment

Likely affects all environments Chrome 57.0.2987.133 (64-bit) Ubuntu 14.04

wcjordan avatar Apr 21 '17 15:04 wcjordan

POC: the bug is still reproducable in IE and Firefox

elefantino avatar Jun 27 '17 08:06 elefantino

How likely is https://github.com/schrodinger/fixed-data-table-2/pull/153 a fix for this?

zweck avatar Jul 31 '17 14:07 zweck

I don't think #153 will fix this. Right now I anticipate it's best to build a one-off solution for your use case and maybe add an example back to the repo, similar to what was done for #149 and the POC linked above.

wcjordan avatar Jul 31 '17 14:07 wcjordan

Ok thanks, we have been using FDT for our project since Dec and have had this issue in our backlog for a while, and it's now time we address it. I essentially have to decide whether to move to a different table solution, write a workaround (like your POC, but needs to work with IE) or try to fix the bug (not sure where to start with that one 🙁 )

zweck avatar Jul 31 '17 14:07 zweck

The POC and a proper fix aren't too far apart. The need would be to make your we handle some set of possible input types / focusable elements and the right events. As well as ensuring we have cross browser support. The possible solution above and notes from #149 and probably useful as well.

Let me know if you do decide to go down that road and I can help talk through the problem.

wcjordan avatar Jul 31 '17 15:07 wcjordan

Would it be possible to simply block the row from scrolling automatically, so the user will have to manually scroll when reaching the edge of the window?

SimonChris avatar Jun 29 '19 10:06 SimonChris

Possibly. Since that's a browser based behavior, I think that would be implemented in your cell component on the input's focus. You could explore integrating some of the ideas from here: https://stackoverflow.com/questions/6740253/disable-scrolling-when-changing-focus-form-elements-ipad-web-app/31472878#31472878

wcjordan avatar Jun 29 '19 15:06 wcjordan