Skip to content

Conversation

mcoker
Copy link
Contributor

@mcoker mcoker commented Sep 3, 2025

fixes #4765
fixes #4759

Questions:

  • Is there a way I can pass this text + component to <SelectGroup label="..."> and have it generate the menu title element/classes so I don't have to hard code it? According to the code, I assumed if I pass a function, it would include the function within <Wrapper /> but it doesn't appear to.
  • I'm not sure what heading level to use - <h2> seemed appropriate considering it's a top-level heading for the page, not necessarily related to the content (cc @thatblindgeye)
  • Should we add a label for the dark theme stuff? This is what it might look like (cc @lboehling)
    Screenshot 2025-09-02 at 8 11 06 PM

@patternfly-build
Copy link
Contributor

patternfly-build commented Sep 3, 2025

Preview: https://pf-org--pr-4766-site.surge.sh

Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

  • For the heading level, Austin's original PR I think had it as an h1. I'm not sure if any heading level will be great - h1 is slightly better because then it doesn't come across as a sub-section of some other h1 on the page (on component pages for example, "High contrast" comes off as a sub-section of the component's CSS variables heading). An h2 might work if there were visible text above the dark/system/light modes area since that renders an h1, just right now an empty h1 is being rendered because we don't pass a label in. Visually, though, we've had these menu groups with headings/labels act as independent groups rather than "This is the label/heading for the entire menu, and this label/heading is a sub-section".
  • For the function bit, I think the React implementation isn't actually setup properly to accept a function? It's typed as only a React Node, but even then we aren't rendering it correctly if a React Node is passed in since the check to wrap stuff in that title class only accepts a function or string. Do we recall the reason for only wrapping the label in this menu groujp class in this way? Passing a Title in doesn't provide the same styling as just a string so either that can't be it or we missed updating some CSS to take that into account.

@mcoker mcoker requested a review from lboehling September 3, 2025 21:04
@edonehoo
Copy link
Collaborator

edonehoo commented Sep 5, 2025

My 2 cents: what if we add a help popover beside the beta label that either links to Medium article or incoming Theming docs? Like this:

image image

Maybe with something like this copy:

Under development
We are still working to add high contrast support across all PatternFly components and extensions. This beta allows you to preview our progress.

[Learn more](Medium article)

I think it's clear enough without it, but would help link to additional context more conveniently 🤷‍♀️

@lboehling
Copy link

  • Should we add a label for the dark theme stuff? This is what it might look like (cc @lboehling)
    Screenshot 2025-09-02 at 8 11 06 PM

I think a label would be good! How about "Display Mode" or "Color Mode"

@mcoker
Copy link
Contributor Author

mcoker commented Sep 9, 2025

Use "Color scheme" and "High contrast" for group titles

Copy link

cloudflare-workers-and-pages bot commented Sep 16, 2025

Deploying patternfly-org with  Cloudflare Pages  Cloudflare Pages

Latest commit: b11ea73
Status:🚫  Build failed.

View logs

@mcoker
Copy link
Contributor Author

mcoker commented Sep 16, 2025

Do we recall the reason for only wrapping the label in this menu group class in this way?

@thatblindgeye did a little diggin', does this help?

Issue: patternfly/patternfly-react#8209
PR: https://github.com/patternfly/patternfly-react/pull/8219/files

And here's a PR where they used it in product - RedHatInsights/frontend-components#1628

Copy link
Contributor

@thatblindgeye thatblindgeye left a comment

Choose a reason for hiding this comment

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

File comment below will depend on this comment for conversation:

I'm wondering if we should allow div and span to be passed as the "title/heading" elements for MenuGroup. Because those are all being appended to the document body, the heading levels are tough to land on which level they should be, or it may not end up making sense.

For example, the Popover heading level is an h3, but it doesn't have any h2 ancestors (nor h1), so it ends up being a random h3 within the page. This Popover may actually work as an h1 being passed as the heading element instead, because at least with VoiceOver, wwhen traversing the rotor menu that's the only heading that shows up since the Popover has the modal attribute. Can confirm in NVDA the Popover heading is also treated as the only heading accessible when trying to navigate with keyboard shortcuts to next/previous headings, so there is a case for this being an h1.

For the MenuGroups, however, their h2 level really only works on the main page of Org since they act as subsections of the h1 there, but on component pages they end up coming off as subsections of the component itself. Thinking about whether it would make more sense to make the current headings in the theme menu plain divs, and just link them to the Select groups via aria-labelledby so that the Select lists are properly named.

Comment on lines 57 to 66
<h2 className="pf-v6-c-menu__group-title">
High contrast{' '}
<Popover
Copy link
Contributor

Choose a reason for hiding this comment

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

This may depend on discussion of my PR comment above, but if we do decide to keep heading levels within this menu, could we structure this in a way so that the popover button and beta label aren't part of the heading? This is what the heading ends up looking like in the a11y tree:

image

Which feels odd for some reason. I think if it was just the High Contrast text and the Beta label it'd look a little better.

onOpenChangeKeys={['Escape']}
>
<SelectGroup>
<SelectGroup label={'Color scheme'} labelHeadingLevel="h2">
Copy link
Contributor

Choose a reason for hiding this comment

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

Also depending if anything changes from above comment, but since we're giving a visible label here let's also update the aria-label of the SelectList to match this visible label.

@mcoker
Copy link
Contributor Author

mcoker commented Sep 16, 2025

@thatblindgeye thanks for the feedback! In this update 34e5308

  • Changed the group labels to <div>s
  • Updated the popover header to h1
  • Added an aria-labelledby to the color scheme SelectList, pointing to the group title id

Other changes unrelated to your feedback

  • Stopped click propagation in the popover so that clicking in the popover doesn't close the select list.
  • Removed the manual isPopoverOpen stuff cursor had added that managed the popover opening/closing. It was keeping the popover from closing when clicking on the trigger (help icon button)

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.

Add beta label to high contrast section of theme switcher How to show high contrast options on org
5 participants