Skip to content

Conversation

@markpadbe
Copy link
Contributor

@markpadbe markpadbe commented Jan 6, 2026

Summary

Fixes issue with fragments being clickable outside preview mode in non-prod environments and improves fragment badge functionality. Also ensures data-fragment-default is not added to the georouting-wrapper, or other simlilar

Changes

Primary Fix

  • Guard addFragmentBadgeClickHandlers to only activate when mepHighlight or mepFragments is enabled
  • Prevents fragment badges from being clickable when preview mode is off

Badge Improvements

  • Fix badge clickability for display:contents elements (tabs, accordions) by checking clicks relative to visible children
  • Improve click detection by measuring actual ::before pseudo-element width
  • Extract openFragment() helper to reduce code duplication
  • Fix badge overlap in zero-height sections using --badge-top-offset CSS variable

Preview Badge Visibility

  • Add back Lingo ROC/fallback badges to "Highlight changes" checkbox (previously only showed with "Highlight fragments")
  • Separate concerns: "Highlight changes" shows MEP/Lingo, "Highlight fragments" shows default fragments only
  • Add back inline Lingo fragment badge support by copying data-mep-lingo-roc/data-mep-lingo-fallback to children in personalization.js

Steps to QA:

  1. navigate this url and observe where you see gray fragment badges(see below): https://main--cc--adobecom.aem.page/products/photoshop?milolibs=fixclickablefragments&mep=%2Fproducts%2Fphotoshop.json--desktop---%2Fcc-shared%2Ffragments%2Fpromos%2F2026%2Famericas%2Fbts-cci-cct-btw-q1%2Fbts-cci-cct-q1.json--default&mepFragments=true
  2. navigate to the before and after links and click in the area where the badges were on the first page(i.e., there will be no badge, but click where you saw the badge).
  3. check outcome:
    expected outcome(after): nothing happens
    actual outcome (before): the fragment opens in a separate window, which is the expected behavior of the fragment badge.

image of gray fragment badges:

Screenshot 2026-01-05 at 4 43 13 PM

Resolves: MWPW-185513

Test URLs:

…onality

Primary Fix:
- Prevent fragment badges from being clickable when preview mode is off in non-prod envd
- Fix data-fragment-default incorrectly added to programmatically generated elements
  using .fragment class (e.g., georouting-wrapper) by checking for data-path attribute

Additional Improvements:
- Fix badge clickability for display:contents elements (tabs, accordions)
- Fix inline Lingo fragments missing badges by copying attributes to children
- Add Lingo badge visibility when mepFragments checkbox is enabled
- Fix badge overlap in zero-height sections
- Rename addLingoFragmentClickHandlers to addFragmentBadgeClickHandlers for clarity
@markpadbe markpadbe requested review from a team as code owners January 6, 2026 00:45
@aem-code-sync
Copy link
Contributor

aem-code-sync bot commented Jan 6, 2026

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

@markpadbe markpadbe added bug Something isn't working do not merge PR should not be merged yet labels Jan 6, 2026
@sukamat sukamat requested a review from spadmasa January 6, 2026 01:07
@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2026

This pull request is not passing all required checks. Please see this discussion for information on how to get all checks passing. Inconsistent checks can be manually retried. If a test absolutely can not pass for a good reason, please add a comment with an explanation to the PR.

|| placeholders) {
const { updateFragDataProps, handleCommands, replacePlaceholders } = await import('../../features/personalization/personalization.js');
if (a.dataset.manifestId || a.dataset.adobeTargetTestid) {
const hasManifestId = a.dataset.manifestId || a.dataset.adobeTargetTestid;
Copy link
Contributor

Choose a reason for hiding this comment

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

you could probably declare these a little earlier and use them directly in the if condition to make the condition a little more readable and save on bytes.

const section = document.querySelector('.mep-lingo-fallback-section');
const frag = section.querySelector('.fragment');
expect(frag).to.exist;
// TODO: Add fallback attribute test coverage in separate PR
Copy link
Contributor

Choose a reason for hiding this comment

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

Might make sense to already create a ticket where this work is described, so this doesn't get forgotten and so we can just remove these lines of code.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

Reminder to set the Ready for Stage label - to queue this to get merged to stage & production.

@spadmasa spadmasa mentioned this pull request Jan 7, 2026
@spadmasa
Copy link

spadmasa commented Jan 7, 2026

Validation done on the pr on the below url
https://main--cc--adobecom.aem.page/products/photoshop?milolibs=fixclickablefragments fragment is not seen clickable when hight is not done and additional additional data-fragment-default path is not seen when fragment path is not present
image
image
fragment click works on fragment badge
image

@spadmasa spadmasa self-assigned this Jan 7, 2026
@spadmasa spadmasa added verified PR has been E2E tested by a reviewer Ready for Stage labels Jan 7, 2026
@mokimo mokimo merged commit e105516 into stage Jan 7, 2026
20 checks passed
@mokimo mokimo deleted the fixclickablefragments branch January 7, 2026 15:38
@markpadbe markpadbe removed the do not merge PR should not be merged yet label Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Ready for Stage verified PR has been E2E tested by a reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants