-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Description
When I refactored the JavaScript for the floating docs banner in #1972, I suggested using a CSS-only solution. I tried unsuccessfully in #1799, but I hope position: sticky
could still work somehow.
Another approach would be to use position: fixed
, but we would have to make the content fixed-height. This would be difficult given the amount of text that is currently in the banner element:




The current JavaScript approach feels a bit complex to me and can lead to some odd scroll behavior.
I think this (S)CSS should work if we can make the element fixed-height:
html:has(#dev-warning, #outdated-warning) {
scroll-padding-top: 38px;
}
body:has(#dev-warning, #outdated-warning) {
margin-top: 38px;
}
#dev-warning,
#outdated-warning {
height: 38px;
position: fixed;
}
I'd be happy to implement a solution if there is a way forward here.
pauloxnet
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
arpan8925 commentedon Mar 28, 2025
Where this floating error visually can be seen? in which page ?
adamzap commentedon Mar 28, 2025
@arpan8925 https://docs.djangoproject.com/en/dev/
Issue django#1988 Fixed
arpan8925 commentedon May 14, 2025
@adamzap I tried doing a PR with that specific commit, but it just took all my commits, don't know how, need help in that case, also check the last commit, it may fix it
Issue django#1988 Fixed