mirror of https://github.com/zulip/zulip.git
recent_view_ui: Fix first row being focused after scrolling to bottom.
If recent view load more banner is at the center as a result of `document.elementFromPoint(topic_center_x, topic_center_y)`, there is no `tr` to focus, resulting in first row to be focused as the closest element as per previous logic. To fix it, we just focus the last row which is just above the load more banner and is visible.
This commit is contained in:
parent
3cc7613841
commit
4750f84ba8
|
@ -1177,7 +1177,10 @@ function recenter_focus_if_off_screen(): void {
|
|||
const topic_center_y = (position.top + position.bottom) / 2;
|
||||
|
||||
const topic_element = document.elementFromPoint(topic_center_x, topic_center_y);
|
||||
if (topic_element === null) {
|
||||
if (
|
||||
topic_element === null ||
|
||||
$(topic_element).parents("#recent-view-content-tbody").length === 0
|
||||
) {
|
||||
// There are two theoretical reasons that the center
|
||||
// element might be null. One is that we haven't rendered
|
||||
// the view yet; but in that case, we should have returned
|
||||
|
|
Loading…
Reference in New Issue