Currently, I have a layout consisting of two rows: the first row is fixed to the top of the screen using sticky-top, and the second row fills the remaining height on the screen with min-vh-100. New content will be added dynamically to the second row's innerHTML, and I want the user to always see the first row as overflow is managed by a scrollbar.
The initial problem arises when a scrollbar appears upon document load/ready, allowing users to scroll down so that part of the content in the second row gets hidden behind the first row. This issue seems to be related to sticky-top, but I'm unsure about how to resolve it. Ideally, a scrollbar should only appear if there is overflow in the second row due to added content. Users should not be able to scroll down and lose sight of the content hidden by the first row.
The next challenge is ensuring that the scrollbar automatically scrolls as new content is added to the second row. I attempted to manipulate the body's scrollTop and scrollHeight properties without success. In the Codepen example provided, scrolling down to hide "Hello" should not be possible.
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
label:hover {
background: LightGray;
cursor: pointer;
}
</style>
</head>
<body class="bg-light">
<div class="container-fluid">
<form name="form" enctype="multipart/x-www-form-urlencoded" action="/execute" method="post">
<div class="row">
<div class="col">
<div class="row pt-2 pb-4 align-items-center justify-content-center bg-light sticky-top">
<button class="submitbutton btn btn-info" type="submit" name="Help" value="Help">Help</button>
<div class="ml-4 mr-4">
<input class="form-control mt-2" type="text" name="Textbox">
</div>
<button class="submitbutton btn btn-success mr-4" type="submit" name="Go" value="Go">Go</button>
<button id="cancel" type="button" class="btn btn-dark">Cancel</button>
</div>
<div class="row bg-dark">
<code class="pl-4 text-white min-vh-100">Hello</code>
</div>
</div>
</div>
</form>
</div>
</body>
</html>
I prefer maintaining the use of rows and columns within this layout since it's integrated into a larger grid design.