-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[60638] Opening a work package (full view) on mobile auto-scrolls to the tab row when not desired #17939
Conversation
…ement should be scrolled to, when there isnt a fragment identifier it shouldnt scroll
This reverts commit 5cd86d5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know whether the assumption that we only want to scroll when there is a hash in the URL is really true. It feels dangerous to me.. Why didn't you simply remove the autofocus
from the label?
if (window.location.hash) { | ||
focusable?.focus(); | ||
} else { | ||
// Prevent scroll if there's no hash in the URL | ||
focusable?.focus({ preventScroll: true }); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not test this, but this whole block could probably be changed to focusable?.focus({ preventScroll: !!window.location.hash });
if (window.location.hash) { | ||
focusable?.focus(); | ||
} else { | ||
// Prevent scroll if there's no hash in the URL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That comment is really not helpful. It is pretty self-explaining, that it should prevent scrolling when there is no hash in the URL, the actual question is why?
If we remove autofocus, there will be some issues for a comment, it won't scroll to the comment set in the URL, for example this test will fail: |
Well, this is coincidence.. The fact, that the users is scrolled to the tabs, triggers the turbo frame of the activity panel to be loaded, and thus the page can be scrolled (a second time) to the actual comment. If we move the hidden label to the top of the page, this will also break. So basically, there is an inderdependency between things that are totally unrelated. |
…ew-on-mobile-auto-scrolls-to-the-tab-row-when-not-desired
Ticket
https://community.openproject.org/wp/60638
What are you trying to accomplish?
Avoid scrolling to the tabs in small screen devices.
Screenshots
Before:
Screen.Recording.2025-02-13.at.16.54.53.mov
After:
Screen.Recording.2025-02-13.at.16.53.30.mov
What approach did you choose and why?
If there is a fragment identifier in the url(id for comment or an activity for example), page will scroll to the identifier, otherwise there won't be a scroll.
Merge checklist