feat: signal async CMS nav ready via flag and event#1304
Open
wesleyboar wants to merge 2 commits into
Open
Conversation
After nav HTML is injected and post-processed, set `data-nav-ready` on `#s-cms-nav` and dispatch `cms-nav:ready` so dependent scripts can safely initialize links that live inside the async-loaded nav. Co-authored-by: Cursor <cursoragent@cursor.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## feat/custom-scripts #1304 +/- ##
====================================================
Coverage 64.09% 64.09%
====================================================
Files 461 461
Lines 13794 13794
Branches 2750 2745 -5
====================================================
Hits 8841 8841
Misses 4604 4604
Partials 349 349
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
wesleyboar
marked this pull request as draft
May 26, 2026 21:13
wesleyboar
added a commit
to TACC/Core-CMS-Custom
that referenced
this pull request
May 26, 2026
## Overview Wrap `findLinksAndSetTargets`, and defer until CMS nav signals it is ready. <details> `open-certain-links-in-new-tab.js` was calling `findLinksAndSetTargets` immediately at load time. On Portal pages the CMS nav is injected asynchronously, so the target links don't exist yet. </details> ## Related - requires TACC/Core-Portal#1304 ## Changes - **refactored** link query and `findLinksAndSetTargets` call into `initLinks` function ## Testing 1. **On CMS page**: Confirm `internal-docs` links **still** open in a new tab. 2. **On Portal**: Confirm `internal-docs` links **newly** open in a new tab. ## UI https://github.com/user-attachments/assets/96879167-070d-4b63-84e0-bfe5a6295542 https://github.com/user-attachments/assets/36309943-33d7-4272-928c-d623ae2efa7f --- Made with [Cursor](https://cursor.com) --------- Co-authored-by: Cursor <cursoragent@cursor.com>
wesleyboar
marked this pull request as ready for review
May 26, 2026 22:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
After the CMS nav HTML is injected and post-processed, set a
data-attr flag and send aCustomEvent. This lets scripts in other repos safely defer link initialization until the async nav is populated.The custom script loaded via #1303 needs to modify a CMS nav link — but on Portal the nav is injected asynchronously, so the link doesn't exist at script load time. This PR adds the signal that lets that script wait safely.
Related
Changes
NAV_READY_ATTRandNAV_READY_EVENTconst'sdata-nav-readyflag andcms-nav:readyevent dispatchTesting
document.getElementById('s-cms-nav').dataset.navReady— should return'true'once the nav is populated.UI
Tip
Tested on https://pprd.ptdatax.tacc.utexas.edu/.
Notes
Note
Gray links in CMS Nav on Portal is known, recent, unrelated bug.
Made with Cursor