Preserve scroll position when opening/closing the relationship modal - #4732
Preserve scroll position when opening/closing the relationship modal#4732Wout-atmire wants to merge 17 commits into
Conversation
…olling Fix scroll position being lost in selected relationships & imported from external sources tabs 133535: Minor fixes for cleaner diff 133535: fix specs 133535: add scroll-service to specs 133535: add top margin on the submission forms 133535: fix clear pagination 133535: Small fixes 133535: retainScrollPosition for search facet filters & labels 133535: add retainScrollPosition to view-mode-switch.component 133535: use retainScrollPosition for search-switch-configuration.component 133535: use retainScrollPosition for search-filters 133535: preserveFragment when filter reset 133535: fragment in pagination state 133535: do not override input value in themed wrapper 133535: add comments 133535: fix flaky search-form.component specs 133535: fix cannot read ".page" of undefined 133535: keep fragment wen changing page 133535: add fragment to query search 133535: add retainScrollPosition to RPP 133535: add fragment to facetValue 133535: add retainScrollPosition to search components for sort order 133535: add retainScrollPosition to search components 133535: Prevent opening and closing of relationship modal from resetting the scroll position
… into w2p-133535_fix-preserve-scroll-position_contribute-9.x-v2
9fd42d5 to
6dd25fa
Compare
8a2d708 to
fd80742
Compare
… into w2p-133535_fix-preserve-scroll-position_contribute-9.x
fd80742 to
672ab40
Compare
|
Hi @Wout-atmire, |
…ve-scroll-position_contribute-9.x
|
I just tested the behaviour, and the scroll position seems to be preserved while using Chrome and Edge browser, but using Firefox the ui still jumps to the top of the page. (Linux / ubuntu) |
|
For me is working: #prevent-scroll is appearing in the background and the mainform behind the modal is not jumping back to the top. pr_4732.mp4 |
nathanmlf
left a comment
There was a problem hiding this comment.
Hey @Wout-atmire! I've tested it on Chrome just like @kanasznagyzoltan and on Firefox like @jlipka . I had the same problem in Firefox, but it works as expected in Chrome.
Just to add to the investigation, my tests were on Windows 11 (I don't think the Firefox issue is specific to Linux). I've attached both videos below.
Firefox (Version 150.0.3 - 64 bits)
pr_4732_firefox.mp4
Google Chrome (Version 148.0.7778.97 - 64 bits)
pr_4732_chrome.mp4
|
Hi @Wout-atmire, |
… into w2p-133535_fix-preserve-scroll-position_contribute-9.x
… into w2p-133535_fix-preserve-scroll-position_contribute-9.x
|
Given #6108, scroll position retention in submission may be unnecessary, so I’m putting this PR on hold until that is merged and we can confirm whether anything is still needed here. Credits to @alexandrevryghem for pointing this out |
References
Description
Fixes the issue of being redirected to the top of the page after opening a modal, by adding a fragment to the URI of the original position were the modal was opened.
Instructions for Reviewers
List of changes in this PR:
this.router.navigatewhen opening a modal are given@Input() retainScrollPosition = false;dynamic-lookup-relation-search-tab.component.htmlds-search-sidebarscroll.service.tsallows to scroll to a specific fragment using JS.scroll-margin-topwhich prevents the sticky header from overlapping our fragment in mind.ScrollService.setFragmentis used.Testing
#prevent-scrollfragment from the URL. And the scroll position should not be reset to the top of the page.Checklist
mainbranch of code (unless it is a backport or is fixing an issue specific to an older branch).npm run lintnpm run check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.