Issue with Bootstrap-JavaScript Autofocus Attribute
Upon page load, the autofocus attribute fails to trigger the addition of the is-focused
class by the Bootstrap-JavaScript for the corresponding (bmd-)form-group
.
https://i.sstatic.net/2V374.png
<fieldset class="form-group bmd-form-group">
<label for="usernameControl" class="bmd-label-floating">Username</label>
<input type="text" class="form-control text-light" required="" id="usernameControl" name="username" autofocus="">
</fieldset>
Label Behavior on Typing
When typing in the field, the label moves up due to the addition of the is-filled
class. However, the focus is still not recognized.
https://i.sstatic.net/FwHZY.png
<fieldset class="form-group bmd-form-group is-filled">
<label for="usernameControl" class="bmd-label-floating">Username</label>
<input type="text" class="form-control text-light" required="" id="usernameControl" name="username" autofocus="">
</fieldset>
Desired Output Issue
The only way to achieve the desired appearance with the is-focused
class is by deselecting and then reselecting the text input (through mouseclicks or the tab key).
https://i.sstatic.net/oUKTi.png
<fieldset class="form-group bmd-form-group is-filled is-focused">
<label for="usernameControl" class="bmd-label-floating">Username</label>
<input type="text" class="form-control text-light" required="" id="usernameControl" name="username" autofocus="">
</fieldset>
Seeking Solutions
Is there any workaround or fix available to address this issue?
Bootstrap Material Design version being used: Version 4.1.1
Input HTML Code:
<fieldset class="form-group">
<label for="usernameControl" class="bmd-label-floating">Username</label>
<input type="text" class="form-control text-light" required="" id="usernameControl" name="username" autofocus="">
</fieldset>