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

Input group tests and tweaks #25352

Closed
wants to merge 12 commits into from
Closed

Input group tests and tweaks #25352

wants to merge 12 commits into from

Conversation

mdo
Copy link
Member

@mdo mdo commented Jan 18, 2018

This PR is adding a new docs/4.0/examples/tests/ folder to house more complex and dense kitchen sink examples of all the supported variations of a component. Perhaps there's a better location, so I'm open to moving this in the future.

For now, I'm using this to test additional input group tweaks in hopes of fixing our rounded corner issue from #25110. I'll split those commits out after verifying what we support is functioning as intended.


screen shot 2018-01-17 at 9 10 11 pm

- In an effort to better support form validation in input groups, the selectors with which we target inputs, selects, and appends/prepends have been significantly overhauled.
- No official backward compatibility has been lost, but it's important to note this does limit the flexibility of the input groups for validation. There's simply no way around it with today's CSS selector support.
- Generally speaking, this provides fewer overrides, aims to isolate normal inputs/selects/files from validated ones, and reduces our overall amount of CSS needed.
@mdo
Copy link
Member Author

mdo commented Jan 18, 2018

I've pushed the CSS changes now. Here's where we stand with rendering validation styles in input groups for text inputs and textareas, custom selects, and custom files. Note that custom files cannot have feedback text or tooltips; their markup makes it an immediate no-go.

screen shot 2018-01-17 at 10 20 45 pm

With these complex CSS changes and clever selectors, nothing is lost in promised support so there's technically no backward incompatibility. However, this CSS does clarify just how far we can go with this component given today's CSS selectors.

I was hoping to have this done for v4 stable, but it'll have to roll out after. I'm going to open a PR to make a note of this bug in the docs and link to the tracking issue.

@ysds I know this isn't perfect, but it's the best we can do. These new selectors are the most effective at separately targeting normal inputs/selects/files and validated ones.

@mdo mdo added this to Inbox in v4.1 via automation Jan 18, 2018
@ysds
Copy link
Member

ysds commented Jan 18, 2018

Let me confirm very soon.

EDIT:

The following case seems broken.

<div class="input-group">
  <div class="input-group-prepend">
    <span class="input-group-text">Text</span>
  </div>
  <input type="text" class="form-control is-invalid">
  <div class="input-group-append">
    <span class="input-group-text">Text</span>
  </div>
</div>
<div class="input-group">
  <div class="input-group-prepend"><span class="input-group-text">Text</span></div>
  <select class="custom-select is-invalid">
    <option selected="">Custom select</option>
  </select>
  <div class="input-group-append"><span class="input-group-text">Text</span></div>
</div>
<div class="input-group">
  <div class="input-group-prepend">
    <span class="input-group-text">Text</span>
  </div>
  <input type="text" class="form-control is-valid">
  <div class="valid-feedback">
    Example valid feedback text
  </div>
</div>
<div class="input-group">
  <div class="input-group-prepend"><span class="input-group-text">Text</span></div>
  <select class="custom-select is-valid">
    <option selected="">Custom select</option>
  </select>
  <div class="valid-feedback">
    Example valid feedback text
  </div>
</div>

@mdo
Copy link
Member Author

mdo commented Jan 18, 2018

Working on those now. I just pushed a commit to resolve the valid feedback one; I had the wrong class in the selector (.valid instead of .is-valid).

@ysds
Copy link
Member

ysds commented Jan 18, 2018

The following no feedback-text case are not supported?

<div class="input-group">
  <div class="input-group-prepend">
    <span class="input-group-text">Text</span>
  </div>
  <input type="text" class="form-control is-invalid">
  <div class="input-group-append">
    <span class="input-group-text">Text</span>
  </div>
</div>

<div class="input-group">
  <div class="input-group-prepend">
    <span class="input-group-text">Text</span>
  </div>
  <input type="text" class="form-control is-valid">
  <div class="input-group-append">
    <span class="input-group-text">Text</span>
  </div>
</div>

@mdo
Copy link
Member Author

mdo commented Jan 18, 2018

I'm unsure just yet on those... it's what I'm trying to work through now. This is the only situation where, so far, I don't think we can differentiate these two situations:

screen shot 2018-01-17 at 11 25 19 pm

In both examples, the input is the second child, is the second from the last child, and comes after a prepend. There's no selector support for changing what we're using nth-last-child from (e.g., :nth-last-child(.input-group-append + 2)).

@mdo
Copy link
Member Author

mdo commented Jan 18, 2018

Oh, and for context, I'm using those outlines to differentiate what gets targeted by each selector.

screen shot 2018-01-17 at 11 27 03 pm

The two blues in each column need to be different colors, purple is the catch all (applying to all inputs in input groups), and green is actually an unnecessary one now.

@ysds
Copy link
Member

ysds commented Jan 18, 2018

Your effort deserves praise. It is up to you to release V4 with some limitations. We have a great utility rounded-0 😂

- "input-group-lg"
---

<style>
Copy link
Member

Choose a reason for hiding this comment

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

@mdo: you need to move this to docs CSS file.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup yup, just putzing around for now :).

@mdo mdo added this to Inbox in v4.1.1 via automation Mar 29, 2018
@mdo mdo removed this from Inbox in v4.1 Mar 29, 2018
@mdo mdo removed this from Inbox in v4.1.1 Apr 24, 2018
@ysds ysds mentioned this pull request Jun 19, 2018
@twbs twbs deleted a comment from ysds Nov 5, 2018
@XhmikosR XhmikosR requested a review from a team as a code owner November 20, 2018 20:06
@mdo
Copy link
Member Author

mdo commented Dec 28, 2018

Closing as stale for now.

@mdo mdo closed this Dec 28, 2018
@mdo mdo deleted the input-group-tests branch December 28, 2018 22:38
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.

None yet

3 participants