feedback icon indicating copy to clipboard operation
feedback copied to clipboard

Sticky header covers scroll targets

Open mootari opened this issue 2 years ago • 7 comments

Describe the bug

When a notebook contains edits, Observable sticks the notebook menu bar to to the top of the viewport.

This bar covers jump targets (anchors, search results) and thus several impedes navigation and orientation within a notebook.

Expected behavior

Scrolling to elements is offset by the height of the sticky bar.

Additional context

This is an longstanding problem that has likely been touched on in other issues as well.

mootari avatar Apr 07 '22 11:04 mootari

Workaround

Add a user style sheet with the following content:

@-moz-document url-prefix("https://observablehq.com/") {
  #__next div[data-node-id], .cm-content > div {
    scroll-margin-top: 52px;
    scroll-margin-bottom: 52px;
  }
}

This also fixes the scrolling issue described in https://github.com/observablehq/feedback/issues/291#issuecomment-1079665613.

Edit: Does not work for jumps from cell references to viewof cells.

mootari avatar Apr 07 '22 11:04 mootari

@mootari Could you attach an example video of this problem. I can't seem to reproduce it (see video clip)

https://user-images.githubusercontent.com/10869236/163855361-a1e3f8f1-a7d0-4719-9521-68521710ce32.mov

.

CobusT avatar Apr 18 '22 18:04 CobusT

Cobus, we fixed this recently.

mbostock avatar Apr 18 '22 20:04 mbostock

@CobusT It's fixed for search results, but still a problem for anchors:

  1. Go to https://observablehq.com/@ambassadors/input-history@2582
  2. In the first cell output, look for the line that says "Go to: inputHistory, statesWidget, Changelog, Todos"
  3. Click either "inputHistory" or "statesWidget"

mootari avatar Apr 19 '22 10:04 mootari

This is still an issue for anchors.

mootari avatar Sep 06 '22 18:09 mootari

I think this has been fixed by the new implementation of the sticky headers. Please re-open if this is not the case. I cannot reproduce.

CobusT avatar Oct 25 '23 19:10 CobusT

Sticky headers still cover the target:

image

mootari avatar Oct 26 '23 10:10 mootari