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.

@vmcj
Copy link
Member

vmcj commented Nov 23, 2025

I like this more over the other PR.

@Kevinjil Kevinjil force-pushed the dynamic-editor-height-flex branch from b867ad1 to d3b8734 Compare November 27, 2025 12:49
@Kevinjil
Copy link
Contributor Author

@vmcj This force-push is a rebase and re-applying the flex-pass on the correct elements.

@vmcj
Copy link
Member

vmcj commented Dec 21, 2025

@Kevinjil can this be merged?

@Kevinjil
Copy link
Contributor Author

Yes, I kept it unmerged as it causes conflicts with the external id branch and this one is probably easier to rebase. Given that that one will take some more time, let's merge it anyway.

@Kevinjil Kevinjil enabled auto-merge December 21, 2025 21:46
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.
@Kevinjil Kevinjil force-pushed the dynamic-editor-height-flex branch from 1d3b15d to 6f9ae3e Compare December 21, 2025 21:47
@Kevinjil Kevinjil added this pull request to the merge queue Dec 21, 2025
Merged via the queue into DOMjudge:main with commit b5f2352 Dec 21, 2025
40 checks passed
@Kevinjil Kevinjil deleted the dynamic-editor-height-flex branch December 21, 2025 22:18
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.

2 participants