Open teosarca opened 5 years ago
~I think we should identify what we're lacking and create separate tickets for this. Right now it's really vague, and it's really hard to think of the effort it needs. I can already say a lot of code will have to be touched as most of the navigation is still the old lump from almost 2yrs ago.~
@teosarca @metas-dh @metas-mk I've added some basic specification/changes that this effort will require.
WiP tests: http://recordit.co/qQO149n5IP
#1A User uses arrow/tab keys to traverse the table, and moves to a cell:
keydown
event. If a control key is found, field is focused and we set a flag in the state:
https://github.com/metasfresh/metasfresh-webui-frontend/blob/dev-2156/src/components/table/TableCell.js#L271 (in this case there's a second focus event called from TableItem.editProperty
)#2A User submits field with {enter}
:
TableCell
. When control key is recognized, we're doing the same thing as before. But now cell's onFocus
handler sets the widget focused flag to false, to prevent infinite loop where user could not leave the field: https://github.com/metasfresh/metasfresh-webui-frontend/blob/dev-2156/src/components/table/TableCell.js#L273 **#3A User presses {enter}
on a a submitted focused field
widgetFocused: false
flag we've set in #2A tableCell
propagates the event to TableItem
. Row's event handler calls editProperty
and then flow is the same as in #1A https://github.com/metasfresh/metasfresh-webui-frontend/blob/dev-2156/src/components/table/TableItem.js#L188The problem I had with lists and dropdowns is caused by the fact, that SelectionDropdown
doesn't get the key event (it is killed by the TableItem). After commenting this https://github.com/metasfresh/metasfresh-webui-frontend/blob/dev-2156/src/components/table/TableItem.js#L196 it works properly. Maybe this can be safely left out ?
SHOWING WIDGETS:
The second thing this effort changes is how we control the visibility of widgets. They can either be
There's a bit of a mess over here, as there's some old code that I don't know and without tests was scared to break it.
this can probably be removed, as the isEditableOnDemand
does a similar check
https://github.com/metasfresh/metasfresh-webui-frontend/blob/dev-2156/src/components/table/TableItem.js#L80
I'm almost sure this can be simplified to just 2 checks, instead of 4 https://github.com/metasfresh/metasfresh-webui-frontend/blob/dev-2156/src/components/table/TableItem.js#L332
Is this a bug or feature request?
FR
What is the current behavior?
Which are the steps to reproduce?
What is the expected or desired behavior?
Consider a view which has a numeric column which is editable.
That column shall be nice and smooth editable a user, using only the keyboard. Similar feeling like editing in Excel, i.e. write the number, press down, write the number, press down (or up).
UPDATE After discussing with @teosarca we agreed on the following behavior:
viewEditorRenderMode
set toalways
should be in a constant edit mode, showing input at all times. Fields with value set toonDemand
should turn editable afterdouble-click
/{enter}
key.{enter}
~UPDATE 2 I played around with different approaches and the one described above does not feel natural. So here's how I think we should approach this:
Arrows
and{tab}
{space}/{down}
{space}/{down}
(so this is seamless with what we normally have for widgets)Arrows
don't traverse between cells but navigate text/lists (Excell only uses one type of field so they don't have this problem. We would otherwise loose the ability to change number values or move across text){tab}
still switches to next cell{enter}
submits the field and blurs the widget, but cell is still selected{enter}
focuses the widget{arrows}/{tab}
work for navigating between the cellsto give some basic idea: