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

Feat(chip, label): Add wrappers for content and actions to manage styling embedded components #5360

Merged
merged 11 commits into from Mar 1, 2023

Conversation

srambach
Copy link
Member

Fixes #5199

This adds wrappers for content (chip only) and the close button (both chip and label) so that the styling of other components (button and badge) is unnecessary or isolated. The new wrappers are spaced using flex with a column gap.

Breaking changes:

  • Creates pf-c-chip__actions and pf-c-chip__content
  • Changes --pf-c-chip__c-button--XXX variables to be --pf-c-chip-actions__c-button--XXX
  • --pf-c-chip__c-badge--MarginLeft is no longer needed and is removed
  • Creates pf-c-label__actions
  • Changes --pf-c-label__c-button--XXX variables to be --pf-c-label-actions__c-button--XXX

@patternfly-build
Copy link

patternfly-build commented Jan 30, 2023

@srambach srambach linked an issue Jan 30, 2023 that may be closed by this pull request
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.

LGTM! Just a few nits. I'll also call out that the negative margin on buttons in the actions container will cause adjacent actions to overlap.
Screenshot 2023-02-07 at 11 23 01 AM

Maybe we move those margins to the actions container?

Comment on lines 32 to 39
--pf-c-chip-actions__c-button--PaddingTop: var(--pf-global--spacer--xs);
--pf-c-chip-actions__c-button--PaddingRight: var(--pf-global--spacer--sm);
--pf-c-chip-actions__c-button--PaddingBottom: var(--pf-global--spacer--xs);
--pf-c-chip-actions__c-button--PaddingLeft: var(--pf-global--spacer--sm);
--pf-c-chip-actions__c-button--MarginTop: calc(var(--pf-c-chip--PaddingTop) * -1);
--pf-c-chip-actions__c-button--MarginRight: calc(var(--pf-c-chip--PaddingRight) / 2 * -1);
--pf-c-chip-actions__c-button--MarginBottom: calc(var(--pf-c-chip--PaddingBottom) * -1);
--pf-c-chip-actions__c-button--FontSize: var(--pf-global--FontSize--xs);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
--pf-c-chip-actions__c-button--PaddingTop: var(--pf-global--spacer--xs);
--pf-c-chip-actions__c-button--PaddingRight: var(--pf-global--spacer--sm);
--pf-c-chip-actions__c-button--PaddingBottom: var(--pf-global--spacer--xs);
--pf-c-chip-actions__c-button--PaddingLeft: var(--pf-global--spacer--sm);
--pf-c-chip-actions__c-button--MarginTop: calc(var(--pf-c-chip--PaddingTop) * -1);
--pf-c-chip-actions__c-button--MarginRight: calc(var(--pf-c-chip--PaddingRight) / 2 * -1);
--pf-c-chip-actions__c-button--MarginBottom: calc(var(--pf-c-chip--PaddingBottom) * -1);
--pf-c-chip-actions__c-button--FontSize: var(--pf-global--FontSize--xs);
--pf-c-chip-actions--c-button--PaddingTop: var(--pf-global--spacer--xs);
--pf-c-chip-actions--c-button--PaddingRight: var(--pf-global--spacer--sm);
--pf-c-chip-actions--c-button--PaddingBottom: var(--pf-global--spacer--xs);
--pf-c-chip-actions--c-button--PaddingLeft: var(--pf-global--spacer--sm);
--pf-c-chip-actions--c-button--MarginTop: calc(var(--pf-c-chip--PaddingTop) * -1);
--pf-c-chip-actions--c-button--MarginRight: calc(var(--pf-c-chip--PaddingRight) / 2 * -1);
--pf-c-chip-actions--c-button--MarginBottom: calc(var(--pf-c-chip--PaddingBottom) * -1);
--pf-c-chip-actions--c-button--FontSize: var(--pf-global--FontSize--xs);

Comment on lines 97 to 105
--pf-c-button--PaddingTop: var(--pf-c-chip-actions__c-button--PaddingTop);
--pf-c-button--PaddingRight: var(--pf-c-chip-actions__c-button--PaddingRight);
--pf-c-button--PaddingBottom: var(--pf-c-chip-actions__c-button--PaddingBottom);
--pf-c-button--PaddingLeft: var(--pf-c-chip-actions__c-button--PaddingLeft);
--pf-c-button--FontSize: var(--pf-c-chip-actions__c-button--FontSize);

margin-top: var(--pf-c-chip-actions__c-button--MarginTop);
margin-right: var(--pf-c-chip-actions__c-button--MarginRight);
margin-bottom: var(--pf-c-chip-actions__c-button--MarginBottom);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
--pf-c-button--PaddingTop: var(--pf-c-chip-actions__c-button--PaddingTop);
--pf-c-button--PaddingRight: var(--pf-c-chip-actions__c-button--PaddingRight);
--pf-c-button--PaddingBottom: var(--pf-c-chip-actions__c-button--PaddingBottom);
--pf-c-button--PaddingLeft: var(--pf-c-chip-actions__c-button--PaddingLeft);
--pf-c-button--FontSize: var(--pf-c-chip-actions__c-button--FontSize);
margin-top: var(--pf-c-chip-actions__c-button--MarginTop);
margin-right: var(--pf-c-chip-actions__c-button--MarginRight);
margin-bottom: var(--pf-c-chip-actions__c-button--MarginBottom);
--pf-c-button--PaddingTop: var(--pf-c-chip-actions--c-button--PaddingTop);
--pf-c-button--PaddingRight: var(--pf-c-chip-actions--c-button--PaddingRight);
--pf-c-button--PaddingBottom: var(--pf-c-chip-actions--c-button--PaddingBottom);
--pf-c-button--PaddingLeft: var(--pf-c-chip-actions--c-button--PaddingLeft);
--pf-c-button--FontSize: var(--pf-c-chip-actions--c-button--FontSize);
margin-top: var(--pf-c-chip-actions--c-button--MarginTop);
margin-right: var(--pf-c-chip-actions--c-button--MarginRight);
margin-bottom: var(--pf-c-chip-actions--c-button--MarginBottom);

| `.pf-c-label__icon` | `<span>` | Initiates a label icon. |
| `.pf-c-label__text` | `<span>` | Initiates label text. |
| `.pf-c-label__editable-text` | `<button>`, `<input>` | Initiates editable label text. See the [editable](#editable) example for details about handling behavior in Javascript.|
| `.pf-c-label__actions` | `<div>` | Creates a wrapper for label actions. **Required for removeable labels** |
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
| `.pf-c-label__actions` | `<div>` | Creates a wrapper for label actions. **Required for removeable labels** |
| `.pf-c-label__actions` | `<span>` | Creates a wrapper for label actions. **Required for removable labels** |

Comment on lines 153 to 160
--pf-c-label-actions__c-button--FontSize: var(--pf-global--FontSize--xs);
--pf-c-label-actions__c-button--MarginTop: calc(var(--pf-global--spacer--form-element) * -1);
--pf-c-label-actions__c-button--MarginRight: calc(var(--pf-global--spacer--form-element) * -1);
--pf-c-label-actions__c-button--MarginBottom: calc(var(--pf-global--spacer--form-element) * -1);
--pf-c-label-actions__c-button--PaddingTop: var(--pf-global--spacer--xs);
--pf-c-label-actions__c-button--PaddingRight: var(--pf-global--spacer--sm);
--pf-c-label-actions__c-button--PaddingBottom: var(--pf-global--spacer--xs);
--pf-c-label-actions__c-button--PaddingLeft: var(--pf-global--spacer--sm);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
--pf-c-label-actions__c-button--FontSize: var(--pf-global--FontSize--xs);
--pf-c-label-actions__c-button--MarginTop: calc(var(--pf-global--spacer--form-element) * -1);
--pf-c-label-actions__c-button--MarginRight: calc(var(--pf-global--spacer--form-element) * -1);
--pf-c-label-actions__c-button--MarginBottom: calc(var(--pf-global--spacer--form-element) * -1);
--pf-c-label-actions__c-button--PaddingTop: var(--pf-global--spacer--xs);
--pf-c-label-actions__c-button--PaddingRight: var(--pf-global--spacer--sm);
--pf-c-label-actions__c-button--PaddingBottom: var(--pf-global--spacer--xs);
--pf-c-label-actions__c-button--PaddingLeft: var(--pf-global--spacer--sm);
--pf-c-label-actions--c-button--FontSize: var(--pf-global--FontSize--xs);
--pf-c-label-actions--c-button--MarginTop: calc(var(--pf-global--spacer--form-element) * -1);
--pf-c-label-actions--c-button--MarginRight: calc(var(--pf-global--spacer--form-element) * -1);
--pf-c-label-actions--c-button--MarginBottom: calc(var(--pf-global--spacer--form-element) * -1);
--pf-c-label-actions--c-button--PaddingTop: var(--pf-global--spacer--xs);
--pf-c-label-actions--c-button--PaddingRight: var(--pf-global--spacer--sm);
--pf-c-label-actions--c-button--PaddingBottom: var(--pf-global--spacer--xs);
--pf-c-label-actions--c-button--PaddingLeft: var(--pf-global--spacer--sm);

margin-top: var(--pf-c-chip__c-button--MarginTop);
margin-right: var(--pf-c-chip__c-button--MarginRight);
margin-bottom: var(--pf-c-chip__c-button--MarginBottom);
.pf-c-chip__content {
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be un-nested from the .pf-c-chip parent container? It's creating extra specificity.

font-size: var(--pf-c-chip__content--FontSize);
}

.pf-c-chip__actions {
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be un-nested from the .pf-c-chip parent container? It's creating extra specificity.

.pf-c-badge {
margin-left: var(--pf-c-chip__c-badge--MarginLeft);
// Actions Button
.pf-c-chip__actions .pf-c-button {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you nest this as .pf-c-button { ... } under the existing .pf-c-chip__actions selector?

Comment on lines 387 to 395
--pf-c-button--FontSize: var(--pf-c-label-actions__c-button--FontSize);
--pf-c-button--PaddingTop: var(--pf-c-label-actions__c-button--PaddingTop);
--pf-c-button--PaddingRight: var(--pf-c-label-actions__c-button--PaddingRight);
--pf-c-button--PaddingBottom: var(--pf-c-label-actions__c-button--PaddingBottom);
--pf-c-button--PaddingLeft: var(--pf-c-label-actions__c-button--PaddingLeft);

margin-top: var(--pf-c-label-actions__c-button--MarginTop);
margin-right: var(--pf-c-label-actions__c-button--MarginRight);
margin-bottom: var(--pf-c-label-actions__c-button--MarginBottom);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
--pf-c-button--FontSize: var(--pf-c-label-actions__c-button--FontSize);
--pf-c-button--PaddingTop: var(--pf-c-label-actions__c-button--PaddingTop);
--pf-c-button--PaddingRight: var(--pf-c-label-actions__c-button--PaddingRight);
--pf-c-button--PaddingBottom: var(--pf-c-label-actions__c-button--PaddingBottom);
--pf-c-button--PaddingLeft: var(--pf-c-label-actions__c-button--PaddingLeft);
margin-top: var(--pf-c-label-actions__c-button--MarginTop);
margin-right: var(--pf-c-label-actions__c-button--MarginRight);
margin-bottom: var(--pf-c-label-actions__c-button--MarginBottom);
--pf-c-button--FontSize: var(--pf-c-label-actions--c-button--FontSize);
--pf-c-button--PaddingTop: var(--pf-c-label-actions--c-button--PaddingTop);
--pf-c-button--PaddingRight: var(--pf-c-label-actions--c-button--PaddingRight);
--pf-c-button--PaddingBottom: var(--pf-c-label-actions--c-button--PaddingBottom);
--pf-c-button--PaddingLeft: var(--pf-c-label-actions--c-button--PaddingLeft);
margin-top: var(--pf-c-label-actions--c-button--MarginTop);
margin-right: var(--pf-c-label-actions--c-button--MarginRight);
margin-bottom: var(--pf-c-label-actions--c-button--MarginBottom);

margin-right: var(--pf-c-label__c-button--MarginRight);
margin-bottom: var(--pf-c-label__c-button--MarginBottom);
margin-left: var(--pf-c-label__c-button--MarginLeft);
.pf-c-label__actions {
Copy link
Contributor

Choose a reason for hiding this comment

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

can this be moved out of the parent .pf-c-label selector?

font-size: var(--pf-c-label__actions--FontSize);
}

.pf-c-label__actions .pf-c-button {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you nest this as .pf-c-button { ... } under .pf-c-label__actions?

@srambach srambach requested a review from mcoker February 7, 2023 19:00
{{{chip-content--attribute}}}
{{/if}}>
{{> @partial-block}}
</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a newline at the end of the file?

| `.pf-c-label__icon` | `<span>` | Initiates a label icon. |
| `.pf-c-label__text` | `<span>` | Initiates label text. |
| `.pf-c-label__editable-text` | `<button>`, `<input>` | Initiates editable label text. See the [editable](#editable) example for details about handling behavior in Javascript.|
| `.pf-c-label__actions` | `<div>` | Creates a wrapper for label actions. **Required for removable labels** |
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
| `.pf-c-label__actions` | `<div>` | Creates a wrapper for label actions. **Required for removable labels** |
| `.pf-c-label__actions` | `<span>` | Creates a wrapper for label actions. **Required for removable labels** |

Comment on lines 32 to 39
--pf-c-chip-actions--c-button--PaddingTop: var(--pf-global--spacer--xs);
--pf-c-chip-actions--c-button--PaddingRight: var(--pf-global--spacer--sm);
--pf-c-chip-actions--c-button--PaddingBottom: var(--pf-global--spacer--xs);
--pf-c-chip-actions--c-button--PaddingLeft: var(--pf-global--spacer--sm);
--pf-c-chip-actions--c-button--MarginTop: calc(var(--pf-c-chip--PaddingTop) * -1);
--pf-c-chip-actions--c-button--MarginRight: calc(var(--pf-c-chip--PaddingRight) / 2 * -1);
--pf-c-chip-actions--c-button--MarginBottom: calc(var(--pf-c-chip--PaddingBottom) * -1);
--pf-c-chip-actions--c-button--FontSize: var(--pf-global--FontSize--xs);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
--pf-c-chip-actions--c-button--PaddingTop: var(--pf-global--spacer--xs);
--pf-c-chip-actions--c-button--PaddingRight: var(--pf-global--spacer--sm);
--pf-c-chip-actions--c-button--PaddingBottom: var(--pf-global--spacer--xs);
--pf-c-chip-actions--c-button--PaddingLeft: var(--pf-global--spacer--sm);
--pf-c-chip-actions--c-button--MarginTop: calc(var(--pf-c-chip--PaddingTop) * -1);
--pf-c-chip-actions--c-button--MarginRight: calc(var(--pf-c-chip--PaddingRight) / 2 * -1);
--pf-c-chip-actions--c-button--MarginBottom: calc(var(--pf-c-chip--PaddingBottom) * -1);
--pf-c-chip-actions--c-button--FontSize: var(--pf-global--FontSize--xs);
--pf-c-chip__actions--c-button--PaddingTop: var(--pf-global--spacer--xs);
--pf-c-chip__actions--c-button--PaddingRight: var(--pf-global--spacer--sm);
--pf-c-chip__actions--c-button--PaddingBottom: var(--pf-global--spacer--xs);
--pf-c-chip__actions--c-button--PaddingLeft: var(--pf-global--spacer--sm);
--pf-c-chip__actions--c-button--MarginTop: calc(var(--pf-c-chip--PaddingTop) * -1);
--pf-c-chip__actions--c-button--MarginRight: calc(var(--pf-c-chip--PaddingRight) / 2 * -1);
--pf-c-chip__actions--c-button--MarginBottom: calc(var(--pf-c-chip--PaddingBottom) * -1);
--pf-c-chip__actions--c-button--FontSize: var(--pf-global--FontSize--xs);

Comment on lines 111 to 119
--pf-c-button--PaddingTop: var(--pf-c-chip-actions--c-button--PaddingTop);
--pf-c-button--PaddingRight: var(--pf-c-chip-actions--c-button--PaddingRight);
--pf-c-button--PaddingBottom: var(--pf-c-chip-actions--c-button--PaddingBottom);
--pf-c-button--PaddingLeft: var(--pf-c-chip-actions--c-button--PaddingLeft);
--pf-c-button--FontSize: var(--pf-c-chip-actions--c-button--FontSize);

margin-top: var(--pf-c-chip-actions--c-button--MarginTop);
margin-right: var(--pf-c-chip-actions--c-button--MarginRight);
margin-bottom: var(--pf-c-chip-actions--c-button--MarginBottom);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
--pf-c-button--PaddingTop: var(--pf-c-chip-actions--c-button--PaddingTop);
--pf-c-button--PaddingRight: var(--pf-c-chip-actions--c-button--PaddingRight);
--pf-c-button--PaddingBottom: var(--pf-c-chip-actions--c-button--PaddingBottom);
--pf-c-button--PaddingLeft: var(--pf-c-chip-actions--c-button--PaddingLeft);
--pf-c-button--FontSize: var(--pf-c-chip-actions--c-button--FontSize);
margin-top: var(--pf-c-chip-actions--c-button--MarginTop);
margin-right: var(--pf-c-chip-actions--c-button--MarginRight);
margin-bottom: var(--pf-c-chip-actions--c-button--MarginBottom);
--pf-c-button--PaddingTop: var(--pf-c-chip__actions--c-button--PaddingTop);
--pf-c-button--PaddingRight: var(--pf-c-chip__actions--c-button--PaddingRight);
--pf-c-button--PaddingBottom: var(--pf-c-chip__actions--c-button--PaddingBottom);
--pf-c-button--PaddingLeft: var(--pf-c-chip__actions--c-button--PaddingLeft);
--pf-c-button--FontSize: var(--pf-c-chip__actions--c-button--FontSize);
margin-top: var(--pf-c-chip__actions--c-button--MarginTop);
margin-right: var(--pf-c-chip__actions--c-button--MarginRight);
margin-bottom: var(--pf-c-chip__actions--c-button--MarginBottom);

Comment on lines 151 to 160
--pf-c-label-actions--MarginRight: calc(var(--pf-global--spacer--form-element) * -1);

// Actions button (close)
--pf-c-label-actions--c-button--FontSize: var(--pf-global--FontSize--xs);
--pf-c-label-actions--c-button--MarginTop: calc(var(--pf-global--spacer--form-element) * -1);
--pf-c-label-actions--c-button--MarginBottom: calc(var(--pf-global--spacer--form-element) * -1);
--pf-c-label-actions--c-button--PaddingTop: var(--pf-global--spacer--xs);
--pf-c-label-actions--c-button--PaddingRight: var(--pf-global--spacer--sm);
--pf-c-label-actions--c-button--PaddingBottom: var(--pf-global--spacer--xs);
--pf-c-label-actions--c-button--PaddingLeft: var(--pf-global--spacer--sm);
Copy link
Contributor

Choose a reason for hiding this comment

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

While the margin-right looks ok visually, it's kind of an arbitrary choice in spacer as far as I can tell. It looks like the margins that reference the form-element spacer may just be out of date?

If we want to keep that same visual spacing, I think this formula for that negative margin works better and would scale well? Seems to scale as long as the action's right padding is greater than the right padding of the label.

Suggested change
--pf-c-label-actions--MarginRight: calc(var(--pf-global--spacer--form-element) * -1);
// Actions button (close)
--pf-c-label-actions--c-button--FontSize: var(--pf-global--FontSize--xs);
--pf-c-label-actions--c-button--MarginTop: calc(var(--pf-global--spacer--form-element) * -1);
--pf-c-label-actions--c-button--MarginBottom: calc(var(--pf-global--spacer--form-element) * -1);
--pf-c-label-actions--c-button--PaddingTop: var(--pf-global--spacer--xs);
--pf-c-label-actions--c-button--PaddingRight: var(--pf-global--spacer--sm);
--pf-c-label-actions--c-button--PaddingBottom: var(--pf-global--spacer--xs);
--pf-c-label-actions--c-button--PaddingLeft: var(--pf-global--spacer--sm);
--pf-c-label__actions--MarginRight: calc(var(--pf-c-label-actions--c-button--PaddingRight) * -1 + var(--pf-c-label--PaddingRight) / 2);
// Actions button (close)
--pf-c-label__actions--c-button--FontSize: var(--pf-global--FontSize--xs);
--pf-c-label__actions--c-button--MarginTop: calc(var(--pf-c-label__actions--c-button--PaddingTop) * -1);
--pf-c-label__actions--c-button--MarginBottom: calc(var(--pf-c-label__actions--c-button--PaddingBottom) * -1);
--pf-c-label__actions--c-button--PaddingTop: var(--pf-global--spacer--xs);
--pf-c-label__actions--c-button--PaddingRight: var(--pf-global--spacer--sm);
--pf-c-label__actions--c-button--PaddingBottom: var(--pf-global--spacer--xs);
--pf-c-label__actions--c-button--PaddingLeft: var(--pf-global--spacer--sm);

Just a side note on that margin, ideally I think it could be setup like the label icon instead where the icon touches the start of the label's padding, regardless the size or padding or whatever. I think to do that, the actions margin-right would just be calc(var(--pf-c-label-actions--c-button--PaddingRight) * -1), but that ends up looking a little tight on the spacing, so we could add .fa-fw to the close icons - that class also exists on the label icon. But that would need to be tested in react, too, to make sure it displays correctly.

margin-right: var(--pf-c-label-actions--MarginRight);
font-size: var(--pf-c-label__actions--FontSize);

& .pf-c-button {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
& .pf-c-button {
.pf-c-button {

font-size: var(--pf-c-chip__actions--FontSize);

// Actions Button
& .pf-c-button {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
& .pf-c-button {
.pf-c-button {

Comment on lines 468 to 469
margin-top: var(--pf-c-label-actions--c-button--MarginTop);
margin-bottom: var(--pf-c-label-actions--c-button--MarginBottom);
Copy link
Contributor

Choose a reason for hiding this comment

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

do you think it's beneficial to keep these on the button? I'm thinking whatever actions we have in here will all have the same padding, so it might be easier just to put it on the actions container?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since the padding is on the button (and it needs to be for the clickable area) I think it's best to keep the negative margin on the same element.

@srambach srambach requested a review from mcoker February 22, 2023 14:39
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.

A couple of comments, but looks like there are a lot of other places chips are used that need to be updated. An alternative could be to make chip.hbs more intelligent like label.hbs so it includes everything needed and can take a chip--id that adds the id and aria-label stuff automatically.

cmichael-mac:patternfly cmichael$ grep -ri '{{#> chip \|{{#> chip}}' src/patternfly/
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:        {{#> chip}}
src/patternfly//components/TextInputGroup/text-input-group--chip-group.hbs:          {{#> chip chip--type="button" chip--modifier="pf-m-overflow"}}
# src/patternfly//components/Chip/examples/Chip.md:{{#> chip chip--type="div"}}
# src/patternfly//components/Chip/examples/Chip.md:{{#> chip chip--type="div"}}
# src/patternfly//components/Chip/examples/Chip.md:{{#> chip chip--type="div"}}
# src/patternfly//components/Chip/examples/Chip.md:{{#> chip chip--type="div"}}
# src/patternfly//components/Chip/examples/Chip.md:{{#> chip chip--type="button" chip--modifier="pf-m-overflow"}}
# src/patternfly//components/Chip/examples/Chip.md:{{#> chip chip--type="div" chip--modifier="pf-m-draggable"}}
src/patternfly//components/Toolbar/toolbar-item-chip-group.hbs:          {{#> chip}}
src/patternfly//components/Toolbar/toolbar-item-chip-group.hbs:          {{#> chip}}
src/patternfly//components/Toolbar/toolbar-item-chip-group.hbs:          {{#> chip}}
src/patternfly//components/InlineEdit/examples/InlineEdit.md:      {{#> chip chip--type="div" chip--modifier="pf-m-read-only"}}
src/patternfly//components/Select/select-chip-group-collapsed.hbs:        {{#> chip}}
src/patternfly//components/Select/select-chip-group-collapsed.hbs:        {{#> chip}}
src/patternfly//components/Select/select-chip-group-collapsed.hbs:        {{#> chip}}
src/patternfly//components/Select/select-chip-group-collapsed.hbs:        {{#> chip chip--type="button" chip--modifier="pf-m-overflow"}}
src/patternfly//components/Select/select-chip-group-expanded.hbs:        {{#> chip}}
src/patternfly//components/Select/select-chip-group-expanded.hbs:        {{#> chip}}
src/patternfly//components/Select/select-chip-group-expanded.hbs:        {{#> chip}}
src/patternfly//components/Select/select-chip-group-expanded.hbs:        {{#> chip}}
src/patternfly//components/Select/select-chip-group-expanded.hbs:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip chip--type="button" chip--modifier="pf-m-overflow"}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip chip--type="button" chip--modifier="pf-m-overflow"}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip chip--type="button" chip--modifier="pf-m-overflow"}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip chip--type="button" chip--modifier="pf-m-overflow"}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:        {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//components/ChipGroup/examples/ChipGroup.md:      {{#> chip}}
src/patternfly//demos/DescriptionList/examples/DescriptionList.md:        {{#> chip}}
src/patternfly//demos/Toolbar/examples/Toolbar.md:              {{#> chip}}
src/patternfly//demos/Toolbar/examples/Toolbar.md:              {{#> chip}}
src/patternfly//demos/Toolbar/examples/Toolbar.md:              {{#> chip}}
src/patternfly//demos/Toolbar/examples/Toolbar.md:                  {{#> chip}}
src/patternfly//demos/Toolbar/examples/Toolbar.md:                  {{#> chip}}
src/patternfly//demos/Toolbar/examples/Toolbar.md:                  {{#> chip}}

Comment on lines 106 to 107
| `.pf-c-button` | `.pf-c-chip__actions <button>` | Initiates the button used to remove the chip. |
| `.pf-c-badge` | `.pf-c-chip__content <span>` | Initiates the badge inside the chip. |
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 nit but AFAIK we've moved away from calling other components out in the docs like this, I don't think we need to include them.

| `.pf-c-label__icon` | `<span>` | Initiates a label icon. |
| `.pf-c-label__text` | `<span>` | Initiates label text. |
| `.pf-c-label__editable-text` | `<button>`, `<input>` | Initiates editable label text. See the [editable](#editable) example for details about handling behavior in Javascript.|
| `.pf-c-label__actions` | `<span>` | Creates a wrapper for label actions. **Required for removable labels** |
| `.pf-c-button` | `.pf-c-label__actions <button>` | Initiates the button used to remove the label. |
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, I don't think we need this.

{{/chip-text}}
{{/chip-content}}
{{#> chip-actions}}
{{#> button button--modifier="pf-m-plain pf-m-small" button--attribute='aria-labelledby="remove_chip_one chip_one" aria-label="Remove" id="remove_chip_one"'}}
Copy link
Contributor

Choose a reason for hiding this comment

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

do you need .pf-m-small on this one? I don't see it on any others.

Suggested change
{{#> button button--modifier="pf-m-plain pf-m-small" button--attribute='aria-labelledby="remove_chip_one chip_one" aria-label="Remove" id="remove_chip_one"'}}
{{#> button button--modifier="pf-m-plain" button--attribute='aria-labelledby="remove_chip_one chip_one" aria-label="Remove" id="remove_chip_one"'}}

@srambach srambach requested a review from mcoker February 28, 2023 21:45
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.

LGTM! Just a few nits.

| `.pf-c-chip__content` | `<span>` | Creates a content wrapper for the chip. **Required** |
| `.pf-c-chip__text` | `<span>` | Initiates the text inside the chip. **Required** |
| `.pf-c-chip__icon` | `<span>` | Initiates the icon inside the chip. |
| `.pf-c-chip__actions` | `<span>` | Creates a wrapper for chip actions. **Required for removeable chips** |
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
| `.pf-c-chip__actions` | `<span>` | Creates a wrapper for chip actions. **Required for removeable chips** |
| `.pf-c-chip__actions` | `<span>` | Creates a wrapper for chip actions. **Required for removable chips** |

Comment on lines 15 to 24
{{#> chip-content}}
{{#> chip-text chip-text--attribute=(concat 'id="' chip-group--id 'chip_one_select_collapsed"')}}
Chip one
{{/chip-text}}
{{/chip-content}}
{{#> chip-actions}}
{{#> button button--modifier="pf-m-plain" button--attribute=(concat 'aria-labelledby="' chip-group--id 'remove_chip_one_select_collapsed ' chip-group--id 'chip_one_select_collapsed" aria-label="Remove" id="' chip-group--id 'remove_chip_one_select_collapsed"')}}
<i class="fas fa-times" aria-hidden="true"></i>
{{/button}}
{{/chip-actions}}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - looks like you've got some indentation stuff going on in a lot of blocks in this file.

{{#> button button--modifier="pf-m-plain" button--attribute=(concat 'aria-labelledby="' chip-group--id 'remove-chip-two ' chip-group--id 'chip-two" aria-label="Remove" id="' chip-group--id 'remove-chip-two"')}}
<i class="fas fa-times" aria-hidden="true"></i>
{{/button}}
{{/chip-actions}}
Copy link
Contributor

Choose a reason for hiding this comment

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

indentation action in this file, too, for all of the {{/chip-actions}} lines

@srambach srambach requested a review from mcoker March 1, 2023 21:20
@mcoker mcoker merged commit 97858c3 into patternfly:v5 Mar 1, 2023
@patternfly-build
Copy link

🎉 This PR is included in version 5.0.0-alpha.22 🎉

The release is available on:

Your semantic-release bot 📦🚀

mattnolting pushed a commit to mattnolting/patternfly that referenced this pull request Mar 2, 2023
mattnolting pushed a commit to mattnolting/patternfly that referenced this pull request May 18, 2023
mattnolting pushed a commit to mattnolting/patternfly that referenced this pull request Dec 12, 2023
@srambach srambach deleted the 5199-chip-label-wrappers branch April 6, 2024 02:14
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.

Chip/label updates - scope nested component styles
3 participants