Skip to content

chore(menu): add tokens#6167

Merged
mcoker merged 8 commits intopatternfly:v6from
mattnolting:chore-menu-tokens
Feb 14, 2024
Merged

chore(menu): add tokens#6167
mcoker merged 8 commits intopatternfly:v6from
mattnolting:chore-menu-tokens

Conversation

@mattnolting
Copy link
Collaborator

@mattnolting mattnolting commented Dec 19, 2023

closes #6162
closes #6218

@patternfly-build
Copy link
Collaborator

patternfly-build commented Dec 19, 2023

@mcoker mcoker changed the title Chore menu tokens chore(menu): add tokens Dec 20, 2023
@mattnolting mattnolting force-pushed the chore-menu-tokens branch 2 times, most recently from b6f701e to 0f068ae Compare December 21, 2023 06:02
@wise-king-sullyman wise-king-sullyman linked an issue Jan 2, 2024 that may be closed by this pull request
@mattnolting mattnolting force-pushed the chore-menu-tokens branch 6 times, most recently from a12cea2 to c2b0b21 Compare January 4, 2024 20:41
@mattnolting mattnolting marked this pull request as ready for review January 5, 2024 15:02
--#{$breadcrumb}__item-divider--FontSize: var( --pf-t--global--font--size--body--sm);

// Breadcrumb link
--#{$breadcrumb}__link--PaddingInlineStart: revert; // use a mutable value for alignment control
Copy link
Member

Choose a reason for hiding this comment

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

Were changed to this file meant to be in this PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this is causing the focus styles to look like this:

image

Disabling this inline start padding causes the link text to be more centered horizontally in the focus ring

Copy link
Member

@srambach srambach left a comment

Choose a reason for hiding this comment

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

Couple of code questions and a couple of visual questions -

Should the split button toggles be pill shaped? Also, this one doesn't have the border radius all around on the disabled version.

I think the highlighting isn't working right on disabled menu items with actions/favs?

2024-01-09_08-40-53.mp4

--#{$menu}--m-drilldown__content--TransitionDuration--transform: var(--#{$pf-global}--TransitionDuration);
--#{$menu}__item-action--hover--BackgroundColor: var(--pf-t--global--background--color--action--plain--hover);
--#{$menu}__item-action--focus--BackgroundColor: var(--pf-t--global--background--color--action--plain--focus);
--#{$menu}__item-action--m-selected--BackgroundColor: var();
Copy link
Member

Choose a reason for hiding this comment

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

Did you mean to do this?

@mattnolting mattnolting force-pushed the chore-menu-tokens branch 3 times, most recently from 46ea5d3 to 0376b24 Compare January 11, 2024 03:57
--#{$menu}__search--PaddingLeft: var(--#{$pf-global}--spacer--md);
--#{$menu}__search--PaddingRight: var(--#{$pf-global}--spacer--md);
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the Figma design shows no inline padding. @lboehling can you confirm? I'm looking at the Filter Search Input design.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I assumed that to be errant.

Screenshot 2024-01-16 at 11 27 48 AM

--#{$menu}__list-item--m-danger--Color: var(--pf-t--global--text--color--status--danger--default);
--#{$menu}__list-item--m-load__item--Color: var(--pf-t--global--text--color--link--default);
--#{$menu}__list-item--has--menu-action--PaddingRight: var(--pf-t--global--spacer--sm);
--#{$menu}__list-item--child--not-active--BackgroundColor: var(--pf-t--global--background--color--action--plain--default);
Copy link
Contributor

Choose a reason for hiding this comment

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

Related to above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This prevents parent siblings from changing background on hover

Copy link
Contributor

Choose a reason for hiding this comment

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

Just wanted to check that this is still needed? Tried removing where this var is being applied locally and at least for the Flyout and Drilldown examples it didn't seem to make a difference

@andrew-ronaldson
Copy link
Collaborator

When I click on the menu examples the borders disappear?
Screenshot 2024-01-18 at 11 33 52 AM

@mattnolting
Copy link
Collaborator Author

mattnolting commented Jan 18, 2024

When I click on the menu examples the borders disappear? Screenshot 2024-01-18 at 11 33 52 AM

@andrew-ronaldson Same thing happens on pf6. That's part of the menu toggle, separate from menu. I'm updating menu toggle now :)

Copy link
Member

@srambach srambach left a comment

Choose a reason for hiding this comment

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

👨‍🍳 fully cooked!

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.

Left some comments, though in v5, hovering/focusing anything in a menu list item (the main item and/or any actions in it) would trigger the background change on the list item, and I see that was removed here. In checking with @lboehling, it looks like we want to keep the behavior from v5, and that impacts a lot of my feedback. Let's regroup on Monday and see what the best path forward is to getting menu updated for alpha.

Comment on lines 57 to 59
&:first-child {
margin-inline-start: calc(var(--#{$breadcrumb}__link--PaddingInlineStart) * -1); // left align first item in list with list bounds while retaining link padding
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did we add padding to the links? There isn't always a __link in an __item, so one of the examples looks like this. I think it would be good to avoid the negative margin if we can.

Screenshot 2024-02-01 at 7 24 15 PM

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Currently, breadcrumbs are misaligned when link is present in the first child.

Screenshot 2024-02-03 at 12 10 18 PM

Removing padding from the first link resolves this issue:

Screenshot 2024-02-03 at 12 11 48 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I was asking why the padding was added in the first place. It doesn't exist in v6 currently. This last example is misaligned but that's because the browser/agent styles are adding padding to the breadcrumb link when it's a button. IMO that's just a bug we overlooked since we don't want the default button element styles - we'd just remove that (set breadcrumb__link to padding: 0).

Screenshot 2024-02-05 at 2 57 40 PM

This is what I'm seeing in this PR currently

Screenshot 2024-02-05 at 3 01 21 PM

Comment on lines 100 to 98
--#{$menu}__item-action--PaddingBlock: var(--pf-t--global--spacer--sm);
--#{$menu}__item-action--PaddingInline: var(--pf-t--global--spacer--md);
--#{$menu}__item-action--FontSize: var(--pf-t--global--font--size--body--default);
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't look like any of these are used?


// - Menu disabled
.#{$menu}__item,
.#{$menu}__action {
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't look like .#{$menu}__action is a thing?

justify-content: center;
padding-block-start: var(--#{$menu}__list-item--m-loading--PaddingTop);
overflow: hidden; // prevents spinner rotation from overflowing
pointer-events: none;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming disabling pointer-events keeps the backgrounds and hover/interaction styles from showing up? It's still focusable and tabbable. Though if it shouldn't be interacted with, it shouldn't have a button inside.

@tlabaj @thatblindgeye is the loading item button something that can interact with, or do you think that's something we might support? As in (just as an example), someone could click on it to stop loading whatever it's doing? Also a side note, at least in this example, the "view more" link has tabindex="-1" so I can't tab to it - is that a bug? https://www.patternfly.org/components/menus/menu/react/with-view-more/

Copy link
Contributor

Choose a reason for hiding this comment

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

@mcoker If you are referring to the spinner, it is currently a span with not onClick callback. At this pont I would not anticipate a use case where we would click on it.

I believe the tabindex="-1" is correct. We do not typically tab through our menu items. We have been navigating them with the up and down arrow keys. @thatblindgeye please correct me if I am wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's correct regarding the tabindex. We do update the tabindex to 0 in React when an item actually receives focus via the arrow keys (just so the previously focused item will receive focus again upon entering the Menu, unless the menu was closed), but otherwise should be -1.

The/one of the only times we'd need to tab to content in a Menu is if there's actions in a footer/outside the actual menu item list.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you are referring to the spinner, it is currently a span with not onClick callback. At this pont I would not anticipate a use case where we would click on it.

@tlabaj I'm referring to the button.pf-v5-c-menu__item that wraps it - you can see it in the screenshot below

Screenshot 2024-02-05 at 3 40 31 PM

Copy link
Contributor

Choose a reason for hiding this comment

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

@mcoker I see. Even thought the spinner is rendered in a button, the onClick is only called when the "View more" button is clicked and not the spinner. If we wanted to allow for that we would need to modify the code. I would not consider ding that right now unless we had a request for it. At that point I would probably get UX's opinion on the interaction.

{{/if}}
<div class="{{pfv}}menu__item-action
{{setModifiers
menu-list-item--IsAriaDisabled='pf-m-aria-disabled'
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 this on both the __item-action container and the action inside?

padding-block-start: var(--#{$menu}--PaddingBlockStart);
padding-block-end: var(--#{$menu}--PaddingBlockEnd);
overflow: hidden;
color: var(--#{$menu}--Color);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is setting color needed?

Comment on lines 430 to 427
color: var(--#{$menu}__list-item--Color);
background-color: var(--#{$menu}__list-item--BackgroundColor);
Copy link
Contributor

Choose a reason for hiding this comment

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

Are either of these needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

background-color is needed, color is not

@mattnolting mattnolting force-pushed the chore-menu-tokens branch 3 times, most recently from b2f975c to 1a1b619 Compare February 6, 2024 21:37
@mattnolting
Copy link
Collaborator Author

@lboehling

Updates:

  • Favorited button hover color
  • List item, dark mode hover mix-blend-mode
  • Removed button role from loading <li>

@srambach
Copy link
Member

srambach commented Feb 8, 2024

It doesn't look like selected menu items are showing the check when selected? https://patternfly-pr-6167.surge.sh/components/menus/menu/#option-multi-select

@lboehling
Copy link

Noticed a few more things!

  • Flyout menus look like they're getting the action plain hover across the entire menu bkg, these should have the same bkg (floating) as the main menu.
Screenshot 2024-02-09 at 11 25 42 AM
  • Drilldown levels 2-X aren't getting the blend mode applied to make them lighter (1st level drilldowns all look correct though)
Screenshot 2024-02-09 at 11 25 55 AM
  • the scrolling menu examples have a weird rounded top corner and inset on the first item of the list
Screenshot 2024-02-09 at 11 26 05 AM

mattnolting and others added 8 commits February 9, 2024 11:52
Co-authored-by: Michael Coker <35148959+mcoker@users.noreply.github.com>

Update src/patternfly/components/Menu/menu.scss

Co-authored-by: Michael Coker <35148959+mcoker@users.noreply.github.com>

Update src/patternfly/components/Menu/menu.scss

Co-authored-by: Michael Coker <35148959+mcoker@users.noreply.github.com>

Update src/patternfly/components/Menu/menu.scss

Co-authored-by: Michael Coker <35148959+mcoker@users.noreply.github.com>

Update src/patternfly/components/Menu/menu.scss

Co-authored-by: Michael Coker <35148959+mcoker@users.noreply.github.com>

Update src/patternfly/components/Menu/menu.scss

Co-authored-by: Michael Coker <35148959+mcoker@users.noreply.github.com>
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! I'll open a couple of follow-up issues for higher and lower priority updates.

--#{$menu}__list-item--BackgroundColor: var(--pf-t--global--background--color--action--plain--default);
--#{$menu}__list-item--hover--BackgroundColor: var(--pf-t--global--background--color--action--plain--hover);
--#{$menu}__list-item--MixBlendMode: normal;
--#{$menu}__list-item--MixBlendMode--hover: var(--pf-t--global--background--color--action--plain--hover--blend);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit

Suggested change
--#{$menu}__list-item--MixBlendMode--hover: var(--pf-t--global--background--color--action--plain--hover--blend);
--#{$menu}__list-item--hover--MixBlendMode: var(--pf-t--global--background--color--action--plain--hover--blend);

padding-inline-end: var(--#{$menu}__list-item--has--menu-action--PaddingInlineEnd);
}

&:has(> :hover) {
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 not just be &:hover? This also needs to apply on focus, :focus-within should do it.


&.pf-m-selected {
.#{$menu}__item-select-icon {
&:is(:hover, :focus, :active, .pf-m-selected) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is :active needed? If it isn't needed, I'd prefer remove it and we can leave :active as it is across the board unless there is a design/code reason for it.

.#{$check} {
--pf-v5-c-check__input--TranslateY: none;
// expand clickable area to full width/height of list__item
input::before {
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't be needed, and I'm pretty sure a pseudo element on an <input> isn't in the spec (this doesn't work in FF).

For checkbox items the __item is a <label>, which should make the whole thing clickable, but it isn't working currently because the label has an invalid for attribute for the input inside of it. Pretty sure we just need to take the for attribute off entirely, it isn't needed.

Comment on lines +593 to +595
&.pf-m-favorited,
&.pf-m-favorited:hover,
&.pf-m-favorited .#{$button} {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this not just target the button? eg, remove the first two selectors.

Suggested change
&.pf-m-favorited,
&.pf-m-favorited:hover,
&.pf-m-favorited .#{$button} {
&.pf-m-favorited .#{$button} {

Comment on lines +14 to +15
--#{$breadcrumb}__link--PaddingInlineStart: var(--pf-t--global--spacer--sm); // use a mutable value for alignment control
--#{$breadcrumb}__link--PaddingInlineEnd: var(--pf-t--global--spacer--sm); // use a mutable value for alignment control
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd still like to understand why padding was added. v5 has inline padding in the buttons example but it's a bug and shouldn't be there.

Comment on lines +139 to +155
.#{$menu},
.#{$menu}__list,
.#{$menu}__group {
@include pf-v5-hidden-visible(grid);
}

// - Menu shared display flex
.#{$menu}__content,
.#{$menu}__list-item,
.#{$menu}__item,
.#{$menu}__item-main,
.#{$menu}__breadcrumb,
.#{$menu}__item-check,
.#{$menu}__item-action,
.#{$menu}__item-action-icon {
@include pf-v5-hidden-visible(flex);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are all of these using hidden-visible? In v5, only __list, __item, and __group use it. If we aren't trying to support the pf-m-hidden/visible[-on-breakpoint] on all of these elements, we should remove this. If we are trying to support that, we should talk about why.


// - Menu item disabled - Menu action disabled
.#{$menu}__list-item,
.#{$menu}__item-action {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is item-action included here? From glancing at it, it looks like the only thing that would apply to item-action is pointer-events but the action that goes inside of item-action (the button component) should handle all of that for us.


&:has(> :hover) {
--#{$menu}__list-item--BackgroundColor: var(--#{$menu}__list-item--hover--BackgroundColor);
--#{$menu}__list-item--MixBlendMode: var(--#{$menu}__list-item--MixBlendMode--hover);
Copy link
Contributor

Choose a reason for hiding this comment

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

For some reason, this is creating a different color between variations of the menu. Basic vs scrollable and the drilldown/breadcrumb examples below as examples:

Screenshot 2024-02-14 at 11 11 36 AM Screenshot 2024-02-14 at 11 11 25 AM Screenshot 2024-02-14 at 11 00 05 AM

Comment on lines +98 to +102
--#{$menu}__item-action--FontSize: var(--pf-t--global--font--size--body--default);
--#{$menu}__item-action--icon--size: var(--#{$menu}__item-action--FontSize, var(--pf-t--global--icon--size--md));
--#{$menu}__item-action--Color: var(--pf-t--global--icon--color--subtle);
--#{$menu}__item-action--m-favorited--Color: var(--pf-t--global--icon--color--favorite--clicked);
--#{$menu}__item-action--button--MinWidth: calc(var(--#{$menu}__item-action--icon--size) + var(--pf-t--global--spacer--sm) * 2);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is the only one that's needed now?

Suggested change
--#{$menu}__item-action--FontSize: var(--pf-t--global--font--size--body--default);
--#{$menu}__item-action--icon--size: var(--#{$menu}__item-action--FontSize, var(--pf-t--global--icon--size--md));
--#{$menu}__item-action--Color: var(--pf-t--global--icon--color--subtle);
--#{$menu}__item-action--m-favorited--Color: var(--pf-t--global--icon--color--favorite--clicked);
--#{$menu}__item-action--button--MinWidth: calc(var(--#{$menu}__item-action--icon--size) + var(--pf-t--global--spacer--sm) * 2);
--#{$menu}__item-action--m-favorited--Color: var(--pf-t--global--icon--color--favorite--clicked);

@patternfly-build
Copy link
Collaborator

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

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.

Consume tokens: Menu

8 participants