UX: Fix edit navigation tags modal height too long on desktop (#24765)

Why this change?

The tags modal loads more tags via infinite loading based on when the last tag in the
given page appears in the viewport for the user. When it comes in to
view, a request is then triggered to fetch additional tags. To ensure
that we are only loading a single page of tags each time the modal is
opened, we previously set a max height on the modal's body to ensure
that the last tag which appears in the modal will be outside of the view
port in the initial load. However, this has regressed recently due to
unknown reasons and resulted in multiple pages of tags being loaded
immediately from the server as the modal's height was not restricted.
This regression was caught by an existing test but was unfortunately
determined as flaky.

What does this change do?

This change restores the max height on the edit navigation menu tags
modal on dekstop.
This commit is contained in:
Alan Guo Xiang Tan 2023-12-07 09:42:04 +08:00 committed by GitHub
parent 1a8b1fc698
commit 7aab65887f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 5 deletions

View File

@ -243,9 +243,7 @@
}
}
&:not(.bookmark-reminder-modal):not(.history-modal):not(
.sidebar__edit-navigation-menu__modal
) {
&:not(.bookmark-reminder-modal):not(.history-modal) {
.modal-body:not(.reorder-categories):not(.poll-ui-builder):not(
.poll-breakdown
) {

View File

@ -1,4 +1,5 @@
@import "more-topics";
@import "sidebar/edit-navigation-menu/tags-modal";
@import "user-card";
@import "user-info";
@import "user-stream-item";

View File

@ -0,0 +1,5 @@
.sidebar__edit-navigation-menu__tags-modal {
.d-modal__body {
max-height: 30vh;
}
}

View File

@ -177,11 +177,11 @@ RSpec.describe "Editing sidebar tags navigation", type: :system do
expect(modal).to have_tag_checkboxes([tag1, tag2, tag3, tag4])
end
xit "loads more tags when the user scrolls views the last tag in the modal and there is more tags to load" do
it "loads more tags when the user scrolls views the last tag in the modal and there is more tags to load" do
Tag.delete_all
tags =
(TagsController::LIST_LIMIT + 50).times.map do |index|
(TagsController::LIST_LIMIT + 1).times.map do |index|
Fabricate(:tag, name: "Tag #{sprintf("%03d", index)}")
end