Skip to content
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

feat(Tooltip): can use 'parent' as the activator when inside a container #2297

Merged
merged 3 commits into from
Dec 27, 2024

Conversation

capdiem
Copy link
Contributor

@capdiem capdiem commented Dec 26, 2024

Resolves #2290

@capdiem capdiem requested a review from Copilot December 26, 2024 16:22

Choose a reason for hiding this comment

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

Copilot reviewed 14 out of 26 changed files in this pull request and generated no comments.

Files not reviewed (12)
  • docs/Masa.Blazor.Docs/wwwroot/data/apis/tooltips/MTooltip-en-US.json: Language not supported
  • docs/Masa.Blazor.Docs/wwwroot/data/apis/tooltips/MTooltip-zh-CN.json: Language not supported
  • docs/Masa.Blazor.Docs/Examples/components/tooltips/Activator.razor: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/proxies/echarts-proxy.js: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/masa-blazor.js: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/mixins/activatable/index.js: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/components/scroll-to-target/index.js: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/chunks/helper.js: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/mixins/intersect/index.js: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/mixins/resize/index.js: Evaluated as low risk
  • src/Masa.Blazor.JS/src/interop.ts: Evaluated as low risk
  • src/Masa.Blazor.JS/src/mixins/activatable.ts: Evaluated as low risk
Comments suppressed due to low confidence (3)

src/Masa.Blazor.JS/src/utils/helper.ts:225

  • Ensure parentElement.parentElement is not null before returning it to avoid potential errors.
if (parentElement.classList.contains('m-btn__content')) {

src/Masa.Blazor.JS/src/utils/helper.ts:216

  • Ensure the selector is not empty or null before querying the DOM to prevent unnecessary errors.
export function getActivator(selector: string): HTMLElement | null {

src/Masa.Blazor/Mixins/Activatable/MActivatableBase.cs:53

  • Ensure that the new behavior introduced by the ActivatorSelector property is covered by tests.
public string ActivatorSelector => Activator == "parent" ? "$parent.{Ref.GetSelector()}" : (Activator ?? "[{ActivatorId}]");
@capdiem capdiem requested a review from Copilot December 27, 2024 02:56

Choose a reason for hiding this comment

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

Copilot reviewed 14 out of 26 changed files in this pull request and generated no comments.

Files not reviewed (12)
  • docs/Masa.Blazor.Docs/wwwroot/data/apis/tooltips/MTooltip-en-US.json: Language not supported
  • docs/Masa.Blazor.Docs/wwwroot/data/apis/tooltips/MTooltip-zh-CN.json: Language not supported
  • docs/Masa.Blazor.Docs/Examples/components/tooltips/Activator.razor: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/components/scroll-to-target/index.js: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/mixins/activatable/index.js: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/mixins/resize/index.js: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/mixins/intersect/index.js: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/masa-blazor.js: Evaluated as low risk
  • src/Masa.Blazor/Mixins/Activatable/MActivatableBase.cs: Evaluated as low risk
  • src/Masa.Blazor/Mixins/Menuable/MMenuable.cs: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/chunks/helper.js: Evaluated as low risk
  • src/Masa.Blazor/wwwroot/js/proxies/echarts-proxy.js: Evaluated as low risk
Comments suppressed due to low confidence (3)

src/Masa.Blazor.JS/src/utils/helper.ts:1

  • [nitpick] The constant 'activator_parent_prefix' should be renamed to 'ACTIVATOR_PARENT_PREFIX' to follow naming conventions for constants.
const activator_parent_prefix = "$parent.";

src/Masa.Blazor.JS/src/utils/helper.ts:218

  • Ensure that the new function 'getActivator' is covered by tests to verify its behavior, especially the handling of the 'parent' prefix.
export function getActivator(selector: string): HTMLElement | null {

src/Masa.Blazor.JS/src/interop.ts:1056

  • The measure function should handle cases where the activator is null. Add a check to ensure that the activator is not null before calling the measure function.
dimensions.activator = measure(activator, isDefaultAttach)
@Qinyouzeng Qinyouzeng merged commit 6298251 into main Dec 27, 2024
1 check passed
@Qinyouzeng Qinyouzeng deleted the feature/tooltip-activator-parent branch December 27, 2024 07:16
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.

[Bug Report] Tooltip: Activator is not working properly
2 participants