Please add :focus-within class like .focus-within with the same styles like .form-control:focus. This allows to e.g. implement custom input components thich uses input as child and as parent a div. The div should then look like an input element which already works with .form-control. With focus-within it would mock it perfectly.
Motivation and context
Currently I crafting a custom input component for tags (aka chips or labels), because Bootstrap has none. I have a blank input element as child and the div parent - which also holds the chips - should look like the input.
This exact styles should be use for the .focus-within:focus-within. Or we could just use:
.form-control:focus-within Because the focus styles related on the base class. I see no reason, why not. As I can see, the form-control class is only used for input element, which never have childs. Otherwise the .focus-within class needs the same styles like .form-control.
The solution is easy:
- &:focus {
+ &:focus, &:focus-within {
Example solution to make a div which has an input (styleless) within look like an input:
Prerequisites
Proposal
Please add
:focus-within
class like.focus-within
with the same styles like.form-control:focus
. This allows to e.g. implement custom input components thich uses input as child and as parent a div. The div should then look like an input element which already works with.form-control
. With focus-within it would mock it perfectly.Motivation and context
Currently I crafting a custom input component for tags (aka chips or labels), because Bootstrap has none. I have a blank input element as child and the div parent - which also holds the chips - should look like the input.
More information
https://github.com/twbs/bootstrap/blob/fecd219983539aa0110a7e09d31b8aa4d5fb4348/scss/forms/_form-control.scss#L34-L45
This exact styles should be use for the
.focus-within:focus-within
. Or we could just use:.form-control:focus-within
Because the focus styles related on the base class. I see no reason, why not. As I can see, the form-control class is only used for input element, which never have childs. Otherwise the.focus-within
class needs the same styles like.form-control
.The solution is easy:
Example solution to make a div which has an input (styleless) within look like an input:
Try it out in the live demo!