[PAGES-46] Investigation for PAGES-41: Try proposed solution Created: 26/Nov/15  Updated: 11/Jan/16  Resolved: 11/Jan/16

Status: Closed
Project: Magnolia pages module
Component/s: None
Affects Version/s: None
Fix Version/s: 5.4.3

Type: Story Priority: Neutral
Reporter: Michael Mühlebach Assignee: Espen Jervidalo
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
dependency
is depended upon by PAGES-41 Selection and visibility state of edi... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:
Sprint: Basel 25
Story Points: 5

 Description   

Investigate in possible solutions for PAGES-41.
Try out the proposed solution from Espen in the comments.



 Comments   
Comment by Espen Jervidalo [ 08/Dec/15 ]

info.magnolia.ui.vaadin.gwt.client.connector.PageEditorConnector#selectElement
Is already keeping track of the scroll position for a selected element. This is used to jump back to the current position after a page-reload. Haven't looked too far yet, but I think it should be re-usable for resetting the selection as well.
It's called from:

info.magnolia.ui.vaadin.gwt.client.editor.jsni.AbstractFrameEventHandler#initNativeTouchSelectionListener
info.magnolia.ui.vaadin.gwt.client.editor.jsni.AbstractFrameEventHandler#initNativeMouseSelectionListener

Update:
This is wrong. The mechanism in info.magnolia.ui.vaadin.gwt.client.editor.jsni.scroll.ElementScrollPositionPreserver is used to keep a selected component in view. Imagine an area with 15 components and you select the last one, due to the appearance of the control bars for all 15 components, the last one will move out of sight.

There is another mechanism implemented to keep the scroll position in between page reloads:

// registers a scroll listener on the wrapper around the iframe element.
info.magnolia.ui.vaadin.gwt.client.widget.PageEditorViewImpl#initDomEventListeners
// keeps track of the scroll position
info.magnolia.ui.vaadin.gwt.client.editor.jsni.AbstractFrameEventHandler#initScrollListener

// resets the scroll position to the last known one.
info.magnolia.ui.vaadin.gwt.client.widget.PageEditorViewImpl#resetScrollTop
// called in, so also on page-load when the page is selected
info.magnolia.ui.vaadin.gwt.client.editor.event.SelectElementEventHandler#onSelectElement

It should be possible to have the selected element (path?) stored somewhere and have it persisted between reloads, the same way the scroll position is preserved and than force-select that one instead of the page-element, as it's done now.
Apart from that we need to consolidate the scroll-quirks and the new keep-selection-after-page-reload-feature to make it more obvious.
I have some javadoc-changes pending.

Generated at Mon Feb 12 06:15:05 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.