I have a form with multiple input elements. Some of the input elements have an error message below the input.
When I use the tab key for page navigation, the website scrolls to the focused input element. When the focused input element has an error message, I can`t see the message below the input element, because the page scrolls only to the focused input. I need to scroll the page down a little bit, so the user can see the error message.
.row {
background: #f8f9fa;
margin-top: 20px;
}
.col {
border: solid 1px #6c757d;
padding: 10px;
}
<link rel="stylesheet" type="text/css" href="//stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<form>
<div class="row">
<div class="col">
<input type="text" class="form-control">
</div>
<div class="col">
<input type="text" class="form-control">
</div>
</div>
<div class="row">
<div class="col">
<input type="text" class="form-control">
</div>
<div class="col">
<input type="text" class="form-control">
</div>
</div>
<div class="row">
<div class="col">
<input type="text" class="form-control">
</div>
<div class="col">
<input type="text" class="form-control">
</div>
</div>
<div class="row">
<div class="col">
<input type="text" class="form-control">
</div>
<div class="col">
<input type="text" class="form-control">
</div>
</div>
<div class="row">
<div class="col">
<input type="text" class="form-control is-invalid">
<div class="invalid-feedback">
Error Text.
</div>
</div>
<div class="col">
<input type="text" class="form-control is-invalid">
<div class="invalid-feedback">
Error Text.
</div>
</div>
</div>
</form>
Use the tab key to navigate throu the form inputs. When you focus the last inputs with the error messages, you can`t see the error text below the input fields.