Skip to content

feat(menu): add high-contrast border - #7725

Merged
mcoker merged 4 commits into
patternfly:high-contrast-q3from
srambach:7600-menu-hi-c
Aug 21, 2025
Merged

mcoker merged 4 commits into
patternfly:high-contrast-q3from
srambach:7600-menu-hi-c

Conversation

@srambach

@srambach srambach commented Aug 5, 2025

Copy link
Copy Markdown
Member

Fixes #7600

Added border to existing pseudoelement on the menu item
Added border to a new ::after on the menu - used the pseudo because otherwise the drilldown calculation of the size was off by the amount of the border.

Note - The nav with drilldown menu items have a slight border radius that touches the menu's border. I'm not sure if this is right or not.
image

@patternfly-build

patternfly-build commented Aug 5, 2025 •

Copy link
Copy Markdown
Collaborator

@srambach srambach linked an issue Aug 5, 2025 that may be closed by this pull request
@mcoker
mcoker requested a review from lboehling August 11, 2025 14:46

@mcoker mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Left a comment about the pseudo border. Also @lboehling should there be a border for selected state? Single selected and multi-selected

--#{$menu}--BackgroundColor: var(--pf-t--global--background--color--floating--default);
--#{$menu}--BoxShadow: var(--pf-t--global--box-shadow--md);
--#{$menu}--Color: var(--pf-t--global--text--color--regular);
--#{$menu}--BorderWidth: var(--pf-t--global--high-contrast--border--width--control--default);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this use the box token?

Suggested change
--#{$menu}--BorderWidth: var(--pf-t--global--high-contrast--border--width--control--default);
--#{$menu}--BorderWidth: var(--pf-t--global--border--width--box--default);

Comment on lines +245 to +252
&::after {
position: absolute;
inset: 0;
pointer-events: none;
content: "";
border: var(--#{$menu}--BorderWidth) solid var(--#{$menu}--BorderColor);
border-radius: inherit;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What's the lift to fix the drilldown stuff if we move this to a regular border? I'd expect menu to have issues with children that overlap the border. I know we have a feature request to make group titles sticky that would mess up this border unless we figured out a z-index thing for this pseudo element.

Screen.Recording.2025-08-11.at.12.54.40.PM.mov

@srambach

Copy link
Copy Markdown
Member Author

Updated to put borders onto the menu element rather than the pseudo. This increases the size of the menu, so the React calculation of the menu height will need to take this into consideration (until then, you'll see the last menu item on a drilled in menu without a bottom border, as it's being cut off)

This also changes the menu to use box-sizing: content-box; because otherwise the drilled in menus, which are shifted 100% are not moved quite far enough and you'll see an increasing gap on the right side of the menu items.

Regression test shows 1px height change where I had to increase the manually specified size to accommodate the new borders. There's also a shift in the modified-width drilldown expansion caret, which I think results from the menu border but I didn't increase the manual width (I can if you like and then I think the regression would pass).
https://drive.google.com/file/d/1ow4uFRTGH8BgrVh6aAYI6qQRW2lLysFk/view?usp=sharing

This will require a fix in React to account for the borders when calculating the height. (in MenuContent.tsx)

@mcoker @thatblindgeye

@srambach
srambach requested a review from mcoker August 13, 2025 19:59
@lboehling

Copy link
Copy Markdown

Left a comment about the pseudo border. Also @lboehling should there be a border for selected state? Single selected and multi-selected

No border needed for selected state since the menu items have other indications for its selected state (check mark) that meet the color contrast requirements.

@lboehling lboehling left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Design looks good to me!

@mcoker

mcoker commented Aug 21, 2025

Copy link
Copy Markdown
Contributor

@srambach

This also changes the menu to use box-sizing: content-box; because otherwise the drilled in menus, which are shifted 100% are not moved quite far enough and you'll see an increasing gap on the right side of the menu items.

I could be wrong, but this looks like it may be due to the borders on the nested menu, which don't look to be disabled. When I disable the borders on nested menus, looks like the menus position correctly without modifying box-sizing.

I wonder if that might mean the height adjustments aren't required, too?

There's also a shift in the modified-width drilldown expansion caret, which I think results from the menu border but I didn't increase the manual width (I can if you like and then I think the regression would pass).

Looking at the examples, the PR has --pf-v6-c-menu--Width: 352px; and core staging has --pf-v6-c-menu--Width: 350px;

@mcoker mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also left a separate comment about the drilldown updates.

Comment on lines +49 to +51
--#{$menu}__list-item--BorderWidth: var(--pf-t--global--high-contrast--border--width--control--default);
--#{$menu}__list-item--BorderColor: transparent;
--#{$menu}__list-item--hover--BorderColor: var(--pf-t--global--border--color--high-contrast);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we update this to set the color by default and use the action--plain tokens?

Suggested change
--#{$menu}__list-item--BorderWidth: var(--pf-t--global--high-contrast--border--width--control--default);
--#{$menu}__list-item--BorderColor: transparent;
--#{$menu}__list-item--hover--BorderColor: var(--pf-t--global--border--color--high-contrast);
--#{$menu}__list-item--BorderWidth: var(--pf-t--global--border--width--action--plain--default);
--#{$menu}__list-item--BorderColor: var(--pf-t--global--border--color--high-contrast);
--#{$menu}__list-item--hover--BorderWidth: var(--pf-t--global--border--width--action--plain--hover);

@mcoker mcoker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Greatness

@mcoker
mcoker merged commit 56ae974 into patternfly:high-contrast-q3 Aug 21, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

High contrast borders - Menu

4 participants