-
Notifications
You must be signed in to change notification settings - Fork 167
🐛 fix(Menu): outside-click functionality issues when activator is 'parent' #2397
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes issues with the outside‐click functionality when using an activator set as "parent" by updating the mixin logic and helper utilities. In addition, multiple module imports have been updated to use the new helper file paths, and deprecated code has been removed.
- Updated outside-click mixin to leverage get$ParentElement for proper parent selector handling.
- Replaced outdated helper imports (e.g. from helper‑fcebaced.js) with the new helper‑6d386307.js.
- Updated module mappings in manifest.json and refactored related touch and page‐stack files.
Reviewed Changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/Masa.Blazor/wwwroot/js/mixins/outside-click/index-47d0ce8d.js | Uses the new helper import and maintains outside‐click listener logic. |
src/Masa.Blazor/wwwroot/js/mixins/outside-click/index-392b22b4.js | Deprecated version removed. |
src/Masa.Blazor/wwwroot/js/mixins/intersect/index-bdfb4be1.js | Updated helper import from helper‑6d386307.js. |
src/Masa.Blazor/wwwroot/js/mixins/activatable/index-82cb7376.js | Updated helper import. |
src/Masa.Blazor/wwwroot/js/manifest.json | Updated file mappings to reflect new file names. |
src/Masa.Blazor/wwwroot/js/components/transition/index-339f8848.js | Updated helper import. |
src/Masa.Blazor/wwwroot/js/components/scroll-to-target/index-0c459122.js | Updated helper import and function call to new intersect module. |
src/Masa.Blazor/wwwroot/js/components/page-stack/touch-64592f9e.js | Refactored touch event handling. |
src/Masa.Blazor/wwwroot/js/components/page-stack/index-c7271ebd.js | Updated helper import. |
src/Masa.Blazor/wwwroot/js/components/overlay/scroll-strategy-dc362cab.js | Updated helper import. |
src/Masa.Blazor/wwwroot/js/components/navigation-drawer/touch-414fa7b7.js | Updated helper import. |
src/Masa.Blazor/wwwroot/js/components/input/index-68029ea9.js | Updated helper import. |
src/Masa.Blazor/wwwroot/js/chunks/helper-6d386307.js | Revised helper implementation with updated API. |
src/Masa.Blazor.JS/src/utils/helper.ts | Improved parent selector handling via get$ParentElement. |
src/Masa.Blazor.JS/src/mixins/outside-click.ts | Updated to check for a parent element using get$ParentElement in click events. |
@@ -46,6 +48,11 @@ class OutsideClick { | |||
|
|||
checkEvent(e: MouseEvent) { | |||
return this.excludedSelectors.some((selector) => { | |||
const parentElement = get$ParentElement(selector); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider caching the result of get$ParentElement(selector) when iterating over multiple excluded selectors to reduce redundant DOM queries if the excludedSelectors array grows in size.
Copilot uses AI. Check for mistakes.
function is$ParentSelector(selector: string) { | ||
return selector.startsWith(activator_parent_prefix); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Adding documentation for get$ParentElement to clarify its behavior—especially that it returns null if no parent element is found—would improve maintainability.
/** | |
* Retrieves the parent element of the element matching the given selector. | |
* | |
* If the selector starts with the `$parent.` prefix, it will look for the parent | |
* element of the element matching the remaining selector. If no parent element | |
* is found, `null` is returned. | |
* | |
* Special case: If the parent element has the class `m-btn__content`, the function | |
* will return the grandparent element instead. | |
* | |
* @param {string} selector - The selector string, potentially prefixed with `$parent.`. | |
* @returns {HTMLElement | null} The parent element, or `null` if not found. | |
*/ |
Copilot uses AI. Check for mistakes.
No description provided.