Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support form-floating on input-group #34527

Closed
wants to merge 15 commits into from
Closed

Conversation

719media
Copy link
Contributor

@719media 719media commented Jul 19, 2021

Making input-group work with form-floating.

Fixes #34513

Copy link
Member

@ffoodd ffoodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, awesome work! Thanks!

I made a fork of your CodePen using the new 5.1 docs path to show the result.

The question now is whether we want to support this or not? What weird issues may pop out of this?

@719media
Copy link
Contributor Author

719media commented Sep 1, 2021

@ffoodd
I went back and reviewed the PR since it was from a month back.
Only thing I saw was a better place for the z-index rule, so I moved it to a more appropriate place.

@ffoodd
Copy link
Member

ffoodd commented Sep 1, 2021

Indeed, nice move! I didn't catch this, thanks :)

@719media
Copy link
Contributor Author

719media commented Oct 6, 2021

It would be awesome if this could be merged for 5.2
With the latest 5.1.2 release, there is a minor issue with how buttons now have align-self: center (see #34834). That can be rectified by adding something like align-self: stretch into the .input-group .btn rule in the changed file. I didn't make that change in this PR, because it's not entirely a "form-floating" thing.
Thanks

@ffoodd
Copy link
Member

ffoodd commented Oct 20, 2021

@719media We reverted the align-self thing on buttons since it introduced regressions in input groups.

@XhmikosR XhmikosR requested a review from mdo December 2, 2021 21:10
Copy link
Contributor

@nkdas91 nkdas91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still an issue with this if we add validation feedbacks .valid-feedback, .invalid-feedback.

https://codepen.io/nkdas91/pen/JjrbeBM

image

@719media
Copy link
Contributor Author

719media commented Dec 13, 2021

@nkdas91 Yes, good catch. My personal opinion of bootstrap validation is that it is so incredibly brittle, I never use it. For me, this is another example of such.

However, if you change the <div class="form-floating"> to <fieldset class="form-floating">, and move the feedback outside, it actually will work with bootstrap validation.

https://codepen.io/nefiga/pen/KKXapZG

Fieldset is a valid tag that can be used with the valid/invalid selectors (see https://html.spec.whatwg.org/multipage/semantics-other.html#selector-invalid).

One issue that DOES crop up in your example that really isn't a problem with form-floating (or this PR), is that the border on the end is no longer rounded. This is because of an issue with rounded corners CSS in bootstrap, and the same issue can actually be seen in bootstrap validation examples if you modify the example to have multiple feedback DIVs, as I have done in the above pen

@XhmikosR XhmikosR changed the title input-group with form-floating Support form-floating on input-group Dec 17, 2021
@XhmikosR XhmikosR requested a review from ffoodd December 17, 2021 05:18
@ffoodd
Copy link
Member

ffoodd commented Feb 8, 2022

Back to this: this PR lacks documentation and examples, which would allow to mention edge cases.

Regarding validation feedback, using fieldset works but is far from ideal when it comes to accessibility (since it'd require a legend at least). I'd better recommend to move the feedback outside and associate it to the form input using id and aria-describedby.

Then you may use spacing utilities to align things as intended, and you'd benefit from the .has-validation class feature on input groups to get rounded corners back. BTW I recommend to only insert feedbacks when needed, instead of having several hidden divs that mess up with rounded corners in input groups.

I made a quick working CodePen demonstrating this. Could be made better by using querySelectorAll() and looping but no need for this POC.

If that sounds good to all of you, @719media would you mind trying to add some docs for this? I guess the form floating page at least need some updates, and maybe the validation page too?

ffoodd
ffoodd previously requested changes Feb 8, 2022
Copy link
Member

@ffoodd ffoodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least needs docs :)

@719media
Copy link
Contributor Author

719media commented Mar 1, 2022

@ffoodd OK I have added some basic docs for the floating labels page.

@719media 719media requested a review from ffoodd March 1, 2022 05:23
@AgentSmith0
Copy link

Would be nice if this PR could me merged. Thanks!

@719media
Copy link
Contributor Author

@ffoodd any way we could get this merged for 5.2.0? Thanks

@AgentSmith0
Copy link

AgentSmith0 commented May 18, 2022

Any updates on this? What speaks against merging this?

@fhughes90
Copy link

Waiting on an update for this as well

@719media
Copy link
Contributor Author

@mdo Any changes requested to get this merged? Or are there things that still just don't feel right here you can expound on?

@nkdas91
Copy link
Contributor

nkdas91 commented Jul 4, 2022

Fixes #36636

@mdo
Copy link
Member

mdo commented Jul 17, 2022

Rebased, squashed, and edited a couple things in #36759. Closing this PR for that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: official support for form-floating and input-group
7 participants