Skip to content

Fix "The sidebar of the repository file list does not have a fixed height #34298" #34321

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

Merged
merged 2 commits into from
May 7, 2025

Conversation

kerwin612
Copy link
Member

There is a known issue where scrolling to the bottom of the page is affected by unknown elements in the footer area:

{{template "custom/body_outer_post" .}}
{{template "base/footer_content" .}}
<script src="{{AssetUrlPrefix}}/js/index.js?v={{AssetVersion}}" onerror="alert('Failed to load asset files from ' + this.src + '. Please make sure the asset files can be accessed.')"></script>
{{template "custom/footer" .}}

after

@github-actions github-actions bot added modifies/templates This PR modifies the template files modifies/frontend labels Apr 30, 2025
@kerwin612
Copy link
Member Author

The aforementioned issue can be resolved by inserting the following code in the initRepoViewFileTree function within web_src/js/features/repo-view-file-tree.ts:

  // TODO: the parent element's full height doesn't work well now,
  // but we can not pollute the global style at the moment, only fix the height problem for pages with this component
  const parentFullHeight = document.querySelector<HTMLElement>('body > div.full.height');
  if (parentFullHeight) parentFullHeight.style.paddingBottom = '0';

  window.addEventListener('scroll', () => {
    const contentBottom = repoViewContent.getBoundingClientRect().bottom;
    if (contentBottom <= sidebar.offsetHeight) {
      sidebar.style.paddingTop = `${sidebar.offsetHeight - contentBottom}px`;
    } else {
      sidebar.style.paddingTop = '0';
    }
  });

after

However, I refrained from directly submitting this solution due to potential performance concerns and its lack of elegance. The current page structure constraints make it challenging to devise alternative approaches. Does anyone have suggestions or alternative solutions?

@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label May 1, 2025
@lunny lunny added this to the 1.25.0 milestone May 1, 2025
@lunny lunny added the topic/ui Change the appearance of the Gitea UI label May 1, 2025
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels May 6, 2025
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 7, 2025
@lunny lunny enabled auto-merge (squash) May 7, 2025 21:08
@lunny lunny merged commit bbfc21e into go-gitea:main May 7, 2025
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 7, 2025
@kerwin612 kerwin612 deleted the fix/#34298-filetree-sidebar-height branch May 7, 2025 22:45
zjjhot added a commit to zjjhot/gitea that referenced this pull request May 9, 2025
* giteaofficial/main:
  [skip ci] Updated translations via Crowdin
  Fix autofocus behavior (go-gitea#34397)
  Fix incorrect divergence cache after switching default branch (go-gitea#34370)
  Add a button editing action secret (go-gitea#34348)
  Fix LFS file not stored in LFS when uploaded/edited via API or web UI (go-gitea#34367)
  [skip ci] Updated translations via Crowdin
  Fix "The sidebar of the repository file list does not have a fixed height go-gitea#34298" (go-gitea#34321)
  feat: add label 'state' to metric 'gitea_users' (go-gitea#34326)
  Update JS and PY dependencies (go-gitea#34391)
  Upgrade go-github v61 -> v71 (go-gitea#34385)
  Bump `@github/relative-time-element` to v4.4.7 (go-gitea#34384)
  gitignore: Visual Studio settings folder (go-gitea#34375)
  Grey out expired artifact on Artifacts list (go-gitea#34314)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/frontend modifies/templates This PR modifies the template files topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants