Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
for example on the front page, you can scroll the page down and edit some node. even if you close the overlay the page is scrolled to top
this is confusing
Comment | File | Size | Author |
---|---|---|---|
#9 | overlay-remain_scroll_position-1468902-9.patch | 1.77 KB | loominade |
#6 | overlay-remain_scroll_position-1468902-6.patch | 1.61 KB | loominade |
Comments
Comment #1
yannickooI thought the hash in the url is the problem but it isn't. I think there is a function in the overlay javascript that ensure that a user cannot scroll the main website. Let us find the evil function!
Comment #2
nod_It's because when you close the overlay there is a php redirect, can't do much about this.
Comment #3
loominade CreditAttribution: loominade commentedno, also without redirect, the scroll position gets lost. I have a possible solution. I will work on it
Comment #4
loominade CreditAttribution: loominade commentedComment #5
nod_I'm sorry but the process is fixing in D8 first and backport to D7 later.
Comment #6
loominade CreditAttribution: loominade commentedthis only works in chrome for now because firefox and ie doesn't seem to support negative margins on the body element
Comment #7
loominade CreditAttribution: loominade commentedsorry this patch is D7 based. but the basic idea is instead of only cutting the page at the viewport height, imitate the scroll position by negative positioning of the body element.
current styling:
desired styling if the scroll position is 1000px and the viewport has a height of 500px:
also we need to save that scroll position somewhere. I did it with
bodyElement.data('scrollPosition', window.scrollY);
.on overlay.close, that css needs to be removed and the former scroll postion needs to be restored. I did it with
bodyElement.scrollTop(bodyElement.data('scrollPosition'));
Comment #8
loominade CreditAttribution: loominade commentedto make it work in IE & firefox it has to be like this:
Comment #9
loominade CreditAttribution: loominade commentedComment #11
yannickooThis also happens when you scroll down, opening an overlay and then closing it. The css in
overlay-parent.css
is blame:The browser cannot know the original scroll position when the body height was manipulated.
Comment #12
Anonymous (not verified) CreditAttribution: Anonymous commentedthe patch overlay-remain_scroll_position-1468902-9.patch failed for me. this is the error I got in my terminal.
Comment #13
prinds CreditAttribution: prinds commentedI have created an experimental module to deal with this problem on 7.x.
http://drupal.org/sandbox/prinds/1918678
My method requires adding two extra events to the overlay module - see patch below.
This allows the module to save the scroll position before the css destroys the page height, and then restore the scroll position after the overlay is fully closed.
Because this method uses the window.name variable as temporary storage, this also works after pressing the save button...
Please have a look at the experimental module.. I think this could easily be built into the overlay module.
Here's the patch I currently have applied to the overlay module, that adds the extra events..
#1918692: Adding on BeforeOpen and on CloseDone events to Overlay
Comment #14
yannickooMarked #1918692: Adding on BeforeOpen and on CloseDone events to Overlay as duplicate.
Comment #15
nod_Overlay is dead to D8 #2088121: Remove Overlay.
Comment #16
shevgenythis does not work for me.