-
Notifications
You must be signed in to change notification settings - Fork 728
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
v8 Grid field focus breaks frozen columns #12560
Comments
I've been poking around this for a few hours, and I suspect that there isn't much that can be done about 1. -- both tabulator navigation and autoscrolling the element to view are done by the browser itself, and even if the key event were to be captured in order to block the native handling, trying to reimplement the desirable parts for a generic Grid would be a scary proposition indeed. Current Grid implementation already does the thing that can be done with a reasonable effort, i.e. immediately moves back the elements that should not have been moved by the autoscrolling, which unfortunately still leaves the flickering. Overriding the tabulator navigation for a specific Grid could be doable, but there is no easy solution or even workaround on the framework level. The 2. and 3. are somewhat easier to work around, since both problems go away if the target column is scrolled into view before focusing the component. Unfortunately scrollToColumn method only exists in Escalator at the moment, although TreeGrid can get to the approximately same results with something like
which would turn the value changes to something like
Sadly regular Grid doesn't use FocusRpc, so there the same workaround would require also extending the GridConnector and using the violator pattern to access the private method in Grid widget, e.g. like this:
and
Of course Escalator's scrollToColumn is public even to begin with, so that one could be called without resorting to JSNI, but there is quite a bit of logic in that Grid method and I didn't have time to check yet what all might break if it is simply bypassed. This same approach could also be used as a starting point for that custom tabulator handling for a specific Grid I mentioned earlier, but a whole lot of other handling would be required on top of that as well. I'll discuss this further with the team next week to see if at least the column scrolling could be made easier. |
I've tried the work-around by extending GridConnector & Grid with examples above. This works quite as expected when focus change is triggered by value change or moved by mouse. Frozen columns will still break by following changes
|
This has proven surprisingly tricky to debug, but there are indeed issues in the element position handling that creep up in some but not all use cases using the workaround I listed above, depending on what exactly updates those positions and in which situations. I think I've found an ugly brute force solution that can deal with the variety of ways I've been testing lately, but unfortunately it's a bit of a hiding-the-symptoms sort of approach. I'm still hoping to find something a bit more elegant that wouldn't have to do quite so many calculations quite so often. |
Vaadin 8.17.0 and Vaadin 8 Grid.
Three issues on grid with frozen columns and editable fields after frozen columns. Field value change triggers focus to other field e.g. using
ValueChangeMode.LAZY
.Tab navigation in fields after frozen column flickers the grid. Just navigate in grid fields using tab.
Frozen columns breaks when focus is moved to field that is not completely visible. Resize view so that second field is not visible (see initial state image) . Type value to first field and wait value change (don't use tab), frozen columns are overlapped with other columns
Initial state
![image](https://user-images.githubusercontent.com/89380304/195775366-195a0372-6273-4629-95e2-8c95224eb663.png)
![image](https://user-images.githubusercontent.com/89380304/195775653-1edaee96-8e69-4e9a-915b-6ef20a2c406c.png)
After value change + focus from server size
Initial state
![image](https://user-images.githubusercontent.com/89380304/195776961-7d1ed4d0-0fe0-44c5-8e2f-8a235a58fc84.png)
![image](https://user-images.githubusercontent.com/89380304/195777028-915aed53-d816-4db3-9ea8-cc4b662b901e.png)
After value change + focus from server size
Attached simple test application used to reproduce issues. Can be run using maven jetty:run.
grid-focus.zip
The text was updated successfully, but these errors were encountered: