-
Notifications
You must be signed in to change notification settings - Fork 387
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
Pin important wiki notices to the top of the page #9021
base: master
Are you sure you want to change the base?
Changes from all commits
ed92ab7
638fb90
60afcba
83f3a03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,9 @@ | |
margin: 0; | ||
} | ||
} | ||
|
||
&__pinned-container { | ||
.sticky-below-navbar(); | ||
background-color: hsl(var(--hsl-b5)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this do anything? |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,10 +48,11 @@ html, body { | |
} | ||
|
||
html { | ||
scroll-padding-top: @nav2-height--pinned; | ||
--scroll-padding: 0; | ||
scroll-padding-top: calc(var(--scroll-padding) + @nav2-height--pinned); | ||
|
||
@media @mobile { | ||
scroll-padding-top: @navbar-height; | ||
scroll-padding-top: calc(var(--scroll-padding) + @navbar-height); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use variable instead so the value using calc only need to be defined once |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
export default class PinnedNoticesScrollPadding { | ||
constructor() { | ||
$(document).on('turbolinks:load', this.adjustScrollPadding); | ||
} | ||
|
||
private adjustScrollPadding = () => { | ||
const pinnedNotices = document.querySelector('.js-wiki-pinned-notices'); | ||
const scrollPadding = pinnedNotices instanceof HTMLElement | ||
? pinnedNotices.getBoundingClientRect().height + 10 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this may be wrong if the window is resized |
||
: 0; | ||
document.documentElement.style.setProperty('--scroll-padding', `${scrollPadding}px`); | ||
}; | ||
} |
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 feel in some cases this may end up annoying people with this being permanently visible and reducing actual content area when reading the page (especially on mobile)
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.
yeah... talked about it with TicClick, who originally suggested idea of this PR, and we both aren't sure how to make it better. I was thinking it could be good to add a dismiss option that puts it back into its normal position, but I don't know if that's actually less "annoying", might feel like a cookie popup where ppl instantly click+close by habit
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'm not sure if this should be necessary at all... maybe the least intrusive solution could be a dismissable cookie popup only for when arriving from a section link and the original notice isn't visible (and it auto-dismisses if you scroll up to the notice)
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.
given how limited screen space on mobile devices is, it makes sense to only show this on desktop.
another thought I had is that there's already an ever-floating table of contents on the left, which could be reused for just a small chip saying
outdated [?]
or something