From 780da500b2248a09b06b37d6eeef76d78577b0f2 Mon Sep 17 00:00:00 2001 From: ishikawa999 Date: Mon, 18 Aug 2025 00:40:04 +0000 Subject: [PATCH 1/2] Adjust scrolling to keep Edit heading visible --- app/assets/javascripts/application-legacy.js | 9 +++++---- app/assets/stylesheets/application.css | 3 ++- app/assets/stylesheets/responsive.css | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/application-legacy.js b/app/assets/javascripts/application-legacy.js index 1219e1ef8..167c3b053 100644 --- a/app/assets/javascripts/application-legacy.js +++ b/app/assets/javascripts/application-legacy.js @@ -23,11 +23,12 @@ function toggleCheckboxesBySelector(selector) { } function showAndScrollTo(id, focus) { - $('#'+id).show(); - if (focus !== null) { - $('#'+focus).focus(); + const el = document.getElementById(id); + if (el) { + el.style.display = ''; // show() + if (focus) document.getElementById(focus)?.focus({ preventScroll: true }); + el.scrollIntoView({ behavior: 'smooth' }); } - $('html, body').animate({scrollTop: $('#'+id).offset().top}, 100); } function toggleRowGroup(el) { diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 568bed2bc..a97e724f6 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -796,7 +796,8 @@ div#issue-changesets p { margin-top: 0; margin-bottom: 1em;} /* Prevent content from being hidden behind a #sticky-issue-header when scrolling via anchor links. */ .controller-issues.action-show div.wiki a[name], .controller-issues.action-show #history div[id^="note-"], -.controller-issues.action-show #history div[id^="change-"] { +.controller-issues.action-show #history div[id^="change-"], +.controller-issues.action-show #update { scroll-margin-top: 50px; } diff --git a/app/assets/stylesheets/responsive.css b/app/assets/stylesheets/responsive.css index b3e8bddd8..6f58f7e95 100644 --- a/app/assets/stylesheets/responsive.css +++ b/app/assets/stylesheets/responsive.css @@ -868,7 +868,8 @@ /* Prevent content from being hidden behind #sticky-issue-header and project-jump when scrolling via anchor links. */ .controller-issues.action-show div.wiki a[name], .controller-issues.action-show #history div[id^="note-"], - .controller-issues.action-show #history div[id^="change-"] { + .controller-issues.action-show #history div[id^="change-"], + .controller-issues.action-show #update { scroll-margin-top: 114px; } } -- 2.50.1