Skip to content

fix: Menu and CSSContainerQuery interop#682

Merged
kurtdoherty merged 1 commit intomainfrom
fix-menu-css-container-query-interop
Aug 14, 2025
Merged

fix: Menu and CSSContainerQuery interop#682
kurtdoherty merged 1 commit intomainfrom
fix-menu-css-container-query-interop

Conversation

@kurtdoherty
Copy link
Contributor

@kurtdoherty kurtdoherty commented Aug 14, 2025

  • Ensures menu groups and dividers will be correctly styled even if they are not direct descendants of the Menu. This is primarily to allow CSSContainerQuery to be used as a parent of groups and dividers.
  • Adds Menu.getClosestMenuElement helper function to allow menu items to more easily find their parent menu. This is particularly useful for menu items that need to manually close the menu.
  • Scouts @reapit/elements/core/container-query over to @reapit/elements/utils/css-container-query to align with it's actual name (CSSContainerQuery) and more clearly communicate it's not a "core" component

@rpt-uk-github
Copy link

rpt-uk-github commented Aug 14, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

code/snyk check is complete. No issues have been found. (View Details)

@codacy-production
Copy link

codacy-production bot commented Aug 14, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for e7d75b11 100.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (e7d75b1) Report Missing Report Missing Report Missing
Head commit (93b8005) 8162 7530 92.26%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#682) 11 11 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@kurtdoherty kurtdoherty force-pushed the fix-menu-css-container-query-interop branch 2 times, most recently from 409c6dd to ec81c0e Compare August 14, 2025 06:18
@@ -0,0 +1,12 @@
import { render } from '@testing-library/react'
import { CSSContainerQuery } from '../css-container-query'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

note: same test as previously implemented, just no describe or it usage.

/**
* Returns the closest ancestor acting as a popover for the given element. Useful in event
* handlers when needing to imperatively control the popover from one of its descendants.
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note: new helper function. This is reexported by Menu

@kurtdoherty kurtdoherty force-pushed the fix-menu-css-container-query-interop branch from ec81c0e to 93b8005 Compare August 14, 2025 06:20
@@ -1,4 +1,7 @@
export * from './breakpoints'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note: export CSS container query, plus other ones that have been missed in recent work.

@@ -85,7 +85,6 @@ export * from './core/checkbox-group'
export * from './core/chip'
export * from './core/chip-group'
export * from './core/compact-select-native'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note: now handled by the export * from './utils' later on in this barrel file

@@ -75,5 +75,5 @@ Menu.Divider = MenuDivider
Menu.Group = MenuGroup
Menu.Item = MenuItem

Copy link
Contributor Author

Choose a reason for hiding this comment

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

note: make the new helper for menu's available. It's just a reexport of the popover one for now.

@kurtdoherty kurtdoherty marked this pull request as ready for review August 14, 2025 06:25
@kurtdoherty kurtdoherty merged commit 86ccaa1 into main Aug 14, 2025
6 checks passed
@kurtdoherty kurtdoherty deleted the fix-menu-css-container-query-interop branch August 14, 2025 06:26
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.

2 participants