Fix `get_adjacent_row`
The get_adjacent_row
code is quite convoluted and is causing headaches with other issues: i.e. #1841, #1944, #1609
Moreover, there is a bug in the current implementation. To reproduce it, please follow these steps:
- Create a table with a single select field.
- Insert 80 rows with a single select option, and a few others without any option selected.
- Create a view and sort it on the single select field, from Z to A so that the rows with empty values come last.
- Open the row edit modal and press the down arrow to select the next row.
- Notice that if you press the down arrow on row 80, the message "No more rows" is returned, when instead there are all the rows with empty values for the single select field (video attached).
Screen_Recording_2024-01-15_at_13.44.40
We should find a more straightforward and cleaner way to find the adjacent row leveraging our handlers without trying to construct such a complicated queryset again.