Skip to content

feat(Button/MenuToggle): added support for hamburger/settings animations #11861

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

Merged

Conversation

thatblindgeye
Copy link
Contributor

@thatblindgeye thatblindgeye commented Jun 5, 2025

What: Closes #11370

Commit 1 adds component logic and new examples.
Commit 2 updates existing examples/demos to use these new implementations.
Commit 6 adds new tests for these new features
Commit 7 makes updates from 6/10/25 animations sync meeting to not restrict the variant nor children for either type of new button (can compare to Commit 1 and 6)
Commit 8 cleans up some examples and prop verbiage

Questiosn:

  • What do we want to do with the "with icons" MenuToggle example? It's currently using the CogIcon, same as the new "settings" toggle. I guess it depends if we would want to ship the "settings" toggle with an icon hardcoded, or expect consumers to still pass in their own icon and isSettings just applies the necessary modifier class.
  • Would we want to keep the Hamburger button example I added that includes a potential approach for making the animation dynamic (the 4th button in that example)?
  • For the PageToggleButton component, would we plan in the next breaking change to force the new hamburger icon with animations, or do we want to allow a consumer to pass their own icon in there?

Assumptions I had made in the code that can use design input:

  • A "hamburger" and "settings" button are setup so that a consumer won't be able to override the icon nor the variant -- they will always render as plain buttons with their respective icons. A "hamburger" button also cannot be given any text content, but a "settings" button can have text in addition to the icon.
    • Main question here is if we want to allow consumers to change the variant for either of these types of buttons.
  • Related to above, the "settings" MenuToggle currently does allow the variant to be customized, but overrides the icon prop (so a consumer is stuck with the CogIcon we ship a "settings" MenuToggle with, but it can be a plain, primary, secondary, etc MenuToggle).

Additional issues:

@thatblindgeye thatblindgeye changed the title Iss11370 setting hamburg btns feat(Button/MenuToggle): added support for hamburger/settings animations Jun 5, 2025
@patternfly-build
Copy link
Contributor

patternfly-build commented Jun 5, 2025

@andrew-ronaldson
Copy link
Collaborator

Would we want to keep the Hamburger button example I added that includes a potential approach for making the animation dynamic (the 4th button in that example)?

We could have a custom button section for the favorite, settings, hamburger and future wacky buttons.

For the PageToggleButton component, would we plan in the next breaking change to force the new hamburger icon with animations, or do we want to allow a consumer to pass their own icon in there?

I don't know that we'd force a full change but what if in the next breaking change the animated one is the default and the old version a variant?

@@ -27,7 +27,7 @@ export const ClipboardCopyToggle: React.FunctionComponent<ClipboardCopyTogglePro
onClick={onClick}
id={id}
aria-labelledby={`${id} ${textId}`}
aria-controls={contentId}
aria-controls={isExpanded ? contentId : undefined}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This update needs to be made as it resolves a critical axe error where the aria-controls attr references a non-existent ID (since the expandable content is dynamically rendered)

@thatblindgeye thatblindgeye marked this pull request as ready for review June 6, 2025 14:14
@thatblindgeye
Copy link
Contributor Author

thatblindgeye commented Jun 10, 2025

From 6/10/25 animations sync meeting: Remove logic that restricts variant and children, replace cog icon in "with icons" with plus icon, remove 4th hamburger button example

Copy link
Member

@rebeccaalpert rebeccaalpert left a comment

Choose a reason for hiding this comment

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

Code looks fine to me!

Not worth blocking imho since this is large already, but demo screenshots appear to be PF5?
Screenshot 2025-06-11 at 2 58 40 PM

@srambach
Copy link
Member

At 1200px, the arrow version of the hamburger briefly flashes - is there a > vs. >= sort of thing going on that could be smoothed out?

2025-06-11_16-52-46.mp4

@thatblindgeye thatblindgeye force-pushed the iss11370_SettingHamburgBtns branch from 27f3073 to 1ef2e90 Compare June 11, 2025 21:49
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.

🍔

Copy link

@kaylachumley kaylachumley left a comment

Choose a reason for hiding this comment

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

looking good

@thatblindgeye
Copy link
Contributor Author

Per discussion between @rebeccaalpert , @mcoker and myself yesterday, we decided to keep this custom hamburger icon in the codebase (just moved to the Button directory) since it's such a specific icon that requires being wrapped in a pf-v[version]-c-button element. When attempted to be added to the react-icons package as a custom icon, the icon was rendering as essentially nothing visually in the preview build, since the icons there aren't wrapped in that button class.

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! Left a couple of nit comments, but they don't seem important. Maybe something to follow-up on

// Because this is such a specific icon that requires being wrapped in a pf-v[current version]-c-button element,
// we don't want to export this to consumers nor include it in the react-icons package as a custom icon.
export const hamburgerIcon = (
<svg viewBox="0 0 10 10" className="pf-v6-c-button--hamburger-icon pf-v6-svg" width="1em" height="1em">
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - can you import the react-tokens for these classes and use token.name to populate the classes instead of hardcoding them?

import { MenuToggle, Flex } from '@patternfly/react-core';

export const MenuToggleSettings: React.FunctionComponent = () => (
<Flex>
Copy link
Contributor

Choose a reason for hiding this comment

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

nit - just an inconsistency, but I noticed the updated custom icon example puts {' '} between the items for a gap instead of wrapping them in <Flex />.

@thatblindgeye thatblindgeye force-pushed the iss11370_SettingHamburgBtns branch from 7f8c60a to f4f6553 Compare June 13, 2025 15:28
@thatblindgeye thatblindgeye force-pushed the iss11370_SettingHamburgBtns branch from f4f6553 to e106295 Compare June 13, 2025 17:02
@rebeccaalpert rebeccaalpert merged commit cf3d84e into patternfly:main Jun 13, 2025
13 checks passed
@patternfly-build
Copy link
Contributor

Your changes have been released in:

  • @patternfly/react-charts@8.3.0-prerelease.13
  • @patternfly/react-code-editor@6.3.0-prerelease.21
  • @patternfly/react-core@6.3.0-prerelease.21
  • @patternfly/react-docs@7.3.0-prerelease.27
  • @patternfly/react-drag-drop@6.3.0-prerelease.21
  • @patternfly/react-icons@6.3.0-prerelease.6
  • @patternfly/react-integration@6.0.0-prerelease.39
  • demo-app-ts@6.0.0-prerelease.124
  • @patternfly/react-styles@6.3.0-prerelease.6
  • @patternfly/react-table@6.3.0-prerelease.21
  • @patternfly/react-templates@6.3.0-prerelease.21
  • @patternfly/react-tokens@6.3.0-prerelease.6

Thanks for your contribution! 🎉

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.

Animation: Masthead - Hamburger & Settings icon buttons (React)
9 participants