Skip to content

Conversation

@Kevinjil
Copy link
Contributor

Alternative to #3198 which relies on flexbox layouts instead of computing the height ourselves, which makes it more generally applicable and probably prevents dozens of edge-cases and accessibility problems. The commit messages contain the rationale.

Using CSS flexboxes, we can stretch the document body to the full
height. For doing so, we will need to use a flexbox layout from some
element of which we know the desired minimal height up to the element in
the DOM tree which should stretch.

We achieve the stretching by defining the minimum height of the body to
be 100 viewport height units and adding the `flex-pass` class to all
elements in between. The `flex-pass` class sets the display method of
the element to be a flexbox to allow stretching of the children, and
sets its own grow and shrink to 1.

To counter some rounding error encountered in Gecko and derived
(firefox) browsers, we subtract 1 pixel from the full viewport height to
prevent a minimal 1 pixel scrollbar.
This includes the source code and diff viewer for submissions and the
executables editor for the system configuration.
Monaco allocates height on initialization, and sets this as a fixed
height. By removing the height on a resize of the body, we force monaco
to recompute the value and claim all newly available space of the
flexbox layout.

Note that we use a resize observer instead of a `$(window).resize`, as
this will also trigger for other DOM changes and not just viewport
changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant