Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#52155] Duplicate scrollbars on project list page when opening the filters section

Dominic Bräunleina38cbad31af1
diff --git a/app/components/projects/table_component.html.erb b/app/components/projects/table_component.html.erb
index 5653fbe2652..728f841b1a7 100644
--- a/app/components/projects/table_component.html.erb
+++ b/app/components/projects/table_component.html.erb
@@ -26,79 +26,81 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See COPYRIGHT and LICENSE files for more details.
++#%>
-
-<div class="generic-table--flex-container">
- <div class="generic-table--container">
- <div class="generic-table--results-container">
- <table class="generic-table" <%= table_id ? "id=\"#{table_id}\"".html_safe : '' %>>
- <colgroup>
- <% columns.each do |column| %>
- <col <%= "opHighlightCol" unless column.attribute == :hierarchy %> >
- <% end %>
- <col>
- </colgroup>
- <thead class="-sticky">
- <tr>
- <% columns.each do |column| %>
- <% if column.attribute == :hierarchy %>
- <th id="project-table--hierarchy-header">
- <div class="generic-table--sort-header-outer generic-table--sort-header-outer_no-highlighting">
- <div class="generic-table--sort-header"
- data-controller="params-from-query"
- data-application-target="dynamic"
- data-params-from-query-all-anchors-value="true"
- data-params-from-query-allowed-value='["query_id", "per_page", "filters", "columns"]'>
- <%= content_tag :a,
- helpers.op_icon("icon-hierarchy"),
- href: href_only_when_not_sort_lft,
- class: "spot-link #{deactivate_class_on_lft_sort}",
- title: t(:label_sort_by, value: %("#{t(:label_project_hierarchy)}")) %>
+<div class="project-list-page--table">
+ <div class="generic-table--flex-container">
+ <div class="generic-table--container <%= container_class %>">
+ <div class="generic-table--results-container">
+ <table class="generic-table" <%= table_id ? "id=\"#{table_id}\"".html_safe : '' %>>
+ <colgroup>
+ <% columns.each do |column| %>
+ <col <%= "opHighlightCol" unless column.attribute == :hierarchy %> >
+ <% end %>
+ <col>
+ </colgroup>
+ <thead class="-sticky">
+ <tr>
+ <% columns.each do |column| %>
+ <% if column.attribute == :hierarchy %>
+ <th id="project-table--hierarchy-header">
+ <div class="generic-table--sort-header-outer generic-table--sort-header-outer_no-highlighting">
+ <div class="generic-table--sort-header"
+ data-controller="params-from-query"
+ data-application-target="dynamic"
+ data-params-from-query-all-anchors-value="true"
+ data-params-from-query-allowed-value='["query_id", "per_page", "filters", "columns"]'>
+ <%= content_tag :a,
+ helpers.op_icon("icon-hierarchy"),
+ href: href_only_when_not_sort_lft,
+ class: "spot-link #{deactivate_class_on_lft_sort}",
+ title: t(:label_sort_by, value: %("#{t(:label_project_hierarchy)}")) %>
+ </div>
</div>
- </div>
- </th>
- <% elsif sortable_column?(column) %>
- <%= build_sort_header column.attribute,
- order_options(column) %>
- <% else %>
- <th>
- <div class="generic-table--sort-header-outer">
- <div class="generic-table--sort-header">
- <span>
- <%= column.caption %>
- </span>
+ </th>
+ <% elsif sortable_column?(column) %>
+ <%= build_sort_header column.attribute,
+ order_options(column) %>
+ <% else %>
+ <th>
+ <div class="generic-table--sort-header-outer">
+ <div class="generic-table--sort-header">
+ <span>
+ <%= column.caption %>
+ </span>
+ </div>
</div>
- </div>
- </th>
+ </th>
+ <% end %>
<% end %>
- <% end %>
- <th>
- <div class="generic-table--empty-header">
- </div>
- </th>
- </tr>
- </thead>
- <tbody>
- <% if rows.empty? %>
- <tr class="generic-table--empty-row">
- <td colspan="<%= headers.length + 1 %>"><%= empty_row_message %></td>
+ <th>
+ <div class="generic-table--empty-header">
+ </div>
+ </th>
</tr>
+ </thead>
+ <tbody>
+ <% if rows.empty? %>
+ <tr class="generic-table--empty-row">
+ <td colspan="<%= headers.length + 1 %>"><%= empty_row_message %></td>
+ </tr>
+ <% end %>
+ <%= render_collection rows %>
+ </tbody>
+ </table>
+ <% if inline_create_link && show_inline_create %>
+ <div class="wp-inline-create-button">
+ <%= inline_create_link %>
+ </div>
<% end %>
- <%= render_collection rows %>
- </tbody>
- </table>
- <% if inline_create_link && show_inline_create %>
- <div class="wp-inline-create-button">
- <%= inline_create_link %>
- </div>
- <% end %>
+ </div>
</div>
</div>
- <% if paginated? %>
- <div data-controller="params-from-query"
- data-application-target="dynamic"
- data-params-from-query-all-anchors-value="true"
- data-params-from-query-allowed-value='["query_id", "columns"]'>
- <%= helpers.pagination_links_full model, { blocked_url_params: [:query_id, :columns] } %>
- </div>
- <% end %>
</div>
+
+<% if paginated? %>
+ <div data-controller="params-from-query"
+ data-application-target="dynamic"
+ data-params-from-query-all-anchors-value="true"
+ data-params-from-query-allowed-value='["query_id", "columns"]'>
+ <%= helpers.pagination_links_full model, { blocked_url_params: [:query_id, :columns] } %>
+ </div>
+<% end %>
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb
index 543a1abae3a..68cee0bcd62 100644
--- a/app/views/projects/index.html.erb
+++ b/app/views/projects/index.html.erb
@@ -28,36 +28,39 @@ See COPYRIGHT and LICENSE files for more details.
++#%>
<% html_title(t(:label_project_plural)) -%>
-<%= render(
- Projects::IndexPageHeaderComponent.new(
- query:,
- current_user:,
- state:,
- params:
+<div class="project-list-page">
+ <%= render(
+ Projects::IndexPageHeaderComponent.new(
+ query:,
+ current_user:,
+ state:,
+ params:
+ )
)
- )
-%>
-
-<%= render(Projects::ProjectsFiltersComponent.new(query:)) do |component|
- if current_user.allowed_globally?(:add_project)
- component.with_button(
- tag: :a,
- href: new_project_path,
- scheme: :primary,
- size: :medium,
- aria: { label: I18n.t(:label_project_new) },
- data: { 'test-selector': 'project-new-button' }) do |button|
- button.with_leading_visual_icon(icon: :plus)
- Project.model_name.human
+ %>
+
+ <%= render(Projects::ProjectsFiltersComponent.new(query:)) do |component|
+ if current_user.allowed_globally?(:add_project)
+ component.with_button(
+ tag: :a,
+ href: new_project_path,
+ scheme: :primary,
+ size: :medium,
+ aria: { label: I18n.t(:label_project_new) },
+ data: { 'test-selector': 'project-new-button' }) do |button|
+ button.with_leading_visual_icon(icon: :plus)
+ Project.model_name.human
+ end
end
end
- end
-%>
+ %>
+
-<%= render Projects::TableComponent.new(
- query:,
- current_user: current_user,
- params:) %>
+ <%= render Projects::TableComponent.new(
+ query:,
+ current_user: current_user,
+ params:) %>
-<%= render Projects::StorageInformationComponent.new(
- current_user: current_user) %>
+ <%= render Projects::StorageInformationComponent.new(
+ current_user: current_user) %>
+</div>
diff --git a/frontend/src/global_styles/content/_projects_list.sass b/frontend/src/global_styles/content/_projects_list.sass
index 581dd2cc73c..b2be6ddd19f 100644
--- a/frontend/src/global_styles/content/_projects_list.sass
+++ b/frontend/src/global_styles/content/_projects_list.sass
@@ -31,6 +31,8 @@ $project-table--child-indentation: 1.1em
$project-table--icon-distance: 5px
$project-table--description-indention: 9px
+$content-padding: 10px
+
@mixin calc-indentation-name($indentation)
// This does not work for big font-sizes
padding-left: calc(#{$indentation} * #{$project-table--child-indentation} + #{$project-table--start-indentation} - #{$project-table--icon-distance})
@@ -102,3 +104,19 @@ $project-table--description-indention: 9px
padding-left: 1em
li
list-style-type: none
+
+// Firefox does not support the popover attribute yet. Thus, the Primer action menus create an ugly scroll inside the table
+// Follow https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/popover#browser_compatibility to see when this can be removed
+body:not(.-browser-firefox)
+ .project-list-page
+ display: flex
+ flex-direction: column
+ max-height: calc(100vh - #{var(--header-height)} - #{$content-padding} - #{$content-padding})
+
+ &--table
+ display: flex
+ flex-grow: 1
+ overflow: auto
+
+ .generic-table--results-container
+ overflow-x: hidden
diff --git a/frontend/src/global_styles/content/_table.sass b/frontend/src/global_styles/content/_table.sass
index d5f8f6ad890..4ecb1d125b5 100644
--- a/frontend/src/global_styles/content/_table.sass
+++ b/frontend/src/global_styles/content/_table.sass
@@ -34,24 +34,9 @@
$input-elements: input, 'input.form--text-field', select, 'select.form--select', '.form--field-affix', 'a.button'
-// These values are based on the new Primer::OpenProject::PageHeader implementation
-$toolbar-height: 195px
-$toolbar-height--mobile: 180px
-
.generic-table--flex-container
display: flex
flex-direction: column
- // Calculate table size by subtracting the space above
- max-height: calc(100vh - #{var(--header-height)} - #{$toolbar-height})
-
- @media screen and (max-width: $breakpoint-sm)
- max-height: calc(100vh - #{var(--header-height)} - #{$toolbar-height--mobile})
-
- .generic-table--container
- display: contents
-
- .generic-table
- position: relative
.generic-table--container
position: relative