Skip to content

fix(TextInputGroup): updated inline padding of icons#6945

Merged
mcoker merged 4 commits intopatternfly:v6from
thatblindgeye:iss6930_tigInsetIcons
Aug 19, 2024
Merged

fix(TextInputGroup): updated inline padding of icons#6945
mcoker merged 4 commits intopatternfly:v6from
thatblindgeye:iss6930_tigInsetIcons

Conversation

@thatblindgeye
Copy link
Contributor

Closes #6930

Couple of notes;

  • The gap between the status icon and utilities is slightly larger now.
    This PR:
    image

    Staging:
    image

  • Did we want padding at the end of the utilities, to create more of a visual gap? Right now when the close button is hovered there's not much of a gap:
    image

    But if we used the same spacing as the icons it may create too much of a visual gap when the button isn't focused:
    image

@thatblindgeye thatblindgeye linked an issue Aug 5, 2024 that may be closed by this pull request
@patternfly-build
Copy link
Collaborator

patternfly-build commented Aug 5, 2024

@mcoker
Copy link
Contributor

mcoker commented Aug 5, 2024

Here's a screenshot of some text input groups with the utilities/close icon inset by the control/horizontal spacer

Screenshot 2024-08-05 at 10 40 46 AM

And here is the same, but with the utilities/close offset by the close button's horizontal padding, pushing it back to the right by the close button's right padding, which will make the close button's icon ("x") visually inset to the control/horizontal spacer, but on hover, you can see the actual button's right edge is closer to the right edge of the text input group

Screenshot 2024-08-05 at 10 42 00 AM

@mcoker
Copy link
Contributor

mcoker commented Aug 5, 2024

From 8.5.24 working session w/ @lboehling

  • Close button is fine on the right edge, @lboehling likes the hover/focus background to be flush with the right edge of the TIG. Assuming plain actions will always be in utilities (as our recommendation anyways), that should work fine
  • The text-input right padding when there is a status icon is set to the 'xl' spacer. We should update that to match the left padding when there is an icon, if possible, which would be something like --pf-t--[spacer-control-horizontal + icon-size + text-to-element like this
    --#{$text-input-group}__main--m-icon__text-input--PaddingInlineStart: calc(var(--pf-t--global--spacer--control--horizontal--default) + var(--pf-v6-c-text-input-group__icon--FontSize) + var(--pf-t--global--spacer--gap--text-to-element--default));
  • If the TIG has utilities, we should reduce the right padding of the text-input to something reasonable to separate text/icons/whatever in the text input from the utilities to the right of it. Probably a small spacer would work well?

@thatblindgeye thatblindgeye requested a review from lboehling August 6, 2024 12:23
Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Everything looks great! Just a couple of nits on the naming and token used in one spot. Lemme know what you think!

--#{$text-input-group}__icon--m-status--InsetInlineEnd: var(--pf-t--global--spacer--sm);
--#{$text-input-group}__icon--InsetInlineStart: var(--pf-t--global--spacer--control--horizontal--default);
--#{$text-input-group}__icon--m-status--InsetInlineEnd: var(--pf-t--global--spacer--control--horizontal--default);
--#{$text-input-group}__c-utilities__icon--m-status--InsetInlineEnd: var(--pf-t--global--spacer--control--horizontal--compact);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a couple of nits on this

  • The syntax for this var is flexible since it's a pretty uncommon pattern. Though typically we reserve the c-[whatever] naming when we reference another component (eg c-button). We'll use --[component/BEM element] (eg --c-button or --utilities) as a general identifier (not necessarily a child or direct child, just in there somewhere) so I wonder if the suggestion below is better?
  • Also not sure if --pf-t--global--spacer--control--horizontal--compact) is the right spacer. Reason being, if a person themed their compact control padding, I wouldn't expect this spacing to update? Since it doesn't necessarily need to conform to an outer button/control padding to match other controls, I think we could just use the --spacer--sm token here. WDYT?
Suggested change
--#{$text-input-group}__c-utilities__icon--m-status--InsetInlineEnd: var(--pf-t--global--spacer--control--horizontal--compact);
--#{$text-input-group}--utilities--icon--m-status--InsetInlineEnd: var(--pf-t--global--spacer--control--horizontal--compact);

@thatblindgeye thatblindgeye force-pushed the iss6930_tigInsetIcons branch from 7cf0c16 to d4d0bd9 Compare August 12, 2024 13:05
@thatblindgeye thatblindgeye requested a review from mcoker August 12, 2024 13:06
@andrew-ronaldson
Copy link
Collaborator

andrew-ronaldson commented Aug 12, 2024

Screenshot 2024-08-12 at 10 20 19 AM Noticed this example has a broken status icon. When I inspect the warning example above it has an `inset-inline-end: var(--pf-v6-c-text-input-group__icon--m-status--InsetInlineEnd)` but it says that same var is undefined on the error example

@thatblindgeye thatblindgeye force-pushed the iss6930_tigInsetIcons branch from d4d0bd9 to 59ce58b Compare August 12, 2024 13:33
@thatblindgeye
Copy link
Contributor Author

@andrew-ronaldson should be fixed now, forgot to update the other instance of the CSS var that was renamed in the latest update

Copy link
Collaborator

@andrew-ronaldson andrew-ronaldson left a comment

Choose a reason for hiding this comment

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

sweet moves, ace!

Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

Looks awesome, just one nit comment that I think should be pretty straight forward?

--#{$text-input-group}__main--first-child--not--text-input--MarginInlineStart: calc(var(--pf-t--global--spacer--control--horizontal--plain) / 2);
--#{$text-input-group}__main--m-icon__text-input--PaddingInlineStart: calc(var(--pf-t--global--spacer--control--horizontal--default) + var(--pf-v6-c-text-input-group__icon--FontSize) + var(--pf-t--global--spacer--gap--text-to-element--default));
--#{$text-input-group}--status__text-input--PaddingInlineEnd: var(--pf-t--global--spacer--xl);
--#{$text-input-group}--status__text-input--PaddingInlineEnd: calc(var(--pf-t--global--spacer--control--horizontal--default) + var(--pf-v6-c-text-input-group__icon--FontSize) + var(--pf-t--global--spacer--gap--text-to-element--default));
Copy link
Contributor

Choose a reason for hiding this comment

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

This is awesome. But when the close button is present, we adjust the status button's inset from --pf-t--global--spacer--control--horizontal--default to --pf-t--global--spacer--sm with the other change in this PR. That leaves a little too much padding between the status icon and text in the text input.

Screenshot 2024-08-12 at 9 34 31 PM

WDYT about creating a variation of this var that swaps --pf-t--global--spacer--control--horizontal--default with --pf-t--global--spacer--sm? Then it looks like this, with the visual spacer being the text-to-element spacer:

Screenshot 2024-08-12 at 9 31 54 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pushed, lemme know if that's what you had in mind. FWIW updating the existing var so that it starts as calc(var(--#{$text-input-group}__icon--m-status--InsetInlineEnd)... also worked, though I imagine if a consumer is updating that specific var we wouldn't want that to affect the spacing between status icon and text input.

@thatblindgeye thatblindgeye force-pushed the iss6930_tigInsetIcons branch from 59ce58b to a17862c Compare August 14, 2024 12:44
Copy link
Contributor

@mcoker mcoker left a comment

Choose a reason for hiding this comment

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

NICE!

@mcoker mcoker merged commit 67ebfac into patternfly:v6 Aug 19, 2024
@patternfly-build
Copy link
Collaborator

🎉 This PR is included in version 6.0.0-alpha.217 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

Text input group inset bugs with icons and validation

4 participants