v3.2 anchor menu#271
Conversation
|
conflict with theme bootstrap.js, need to refactor
|
|
@copilot There is a conflict in our wordpress theme with the anchor menu react component, we need to refactor to use the UDS bootstrap anchor menu. example code of UDS bootstrap menu: Task list:
|
Co-authored-by: jkcox <8856538+jkcox@users.noreply.github.com> Agent-Logs-Url: https://github.com/ASU-KE/UnityBlocks/sessions/1ac40d08-7a06-413c-aa8f-7eaad680dad0
…script; clear frontend.js Agent-Logs-Url: https://github.com/ASU-KE/UnityBlocks/sessions/ce70a11a-de4b-49cc-9b3f-77ee59c9267e Co-authored-by: jkcox <8856538+jkcox@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ASU-KE/UnityBlocks/sessions/24c0c653-6f73-455d-85cf-c5fb2cb19654 Co-authored-by: jkcox <8856538+jkcox@users.noreply.github.com>
Refactor anchor menu: replace React component with UDS Bootstrap HTML
| ) | ||
| ), | ||
| 'attributes' => array( | ||
| 'displayType' => array( |
There was a problem hiding this comment.
this is related to news grid - looks like it was missed when the block manifest feature was added in v3.1.
There was a problem hiding this comment.
I saw this and decided to put a News Grid on the page I was using to test the Anchor Menu, since I'm paranoid about them all suddenly failing to work. It worked in the editor, but failed to show up on the front-end. This error was in the console: TypeError: undefined is not an object (evaluating 'globalThis.process.env.NODE_ENV').
However, building a new page with similar elements (anchor menu, news grid, and tablets) worked just fine. So I decided to copy the content verbatim from my bad page to the new one. The News Grid did not work there either.
You know what fixed it? Renaming the anchor I had called 'process' to something else. Only seems to affect the News Grid front-end display. Weird. Likely not related to Anchor Menu updates, as it existed before. Which is to say, don't close the 'process' issue just yet.
| */ | ||
| import { AnchorMenu } from "../../resources/asu-unity-stack/packages/components-core/src/components/AnchorMenu" | ||
| /** | ||
| import { AnchorMenu } from "@asu-unity-stack/packages/unity-react-core/src/components/AnchorMenu/AnchorMenu"; |
There was a problem hiding this comment.
This was updated while I was trying to continue to use the react components. Since the editor functionality isn't critical I think it's ok to keep this since it works as a visual for site editors.
There was a problem hiding this comment.
@jkcox Just for clarification, this would mean that it's Bootstrap on the front end, and using the React component in the editor? But...the actual package now and not from any sub-module or fork?
There was a problem hiding this comment.
React in the editor, bootstrap on the front end.
This was built before the KE fork was deleted.
We'll need to update this moving forward in a separate task, no one else will be able to npm run build
I can still "see" the submodule and all the files, so I think locally I would be able to build... but anyone else pulling this down and then doing an init on the submodule, it will fail.
|
The code updates look good, I tested locally on the main theme branch and I have a couple of things to note:
There is a separate issue with pulling updates through Git Updater that I will look into, but it is unrelated to this PR. |
|
@wmcconnell I see nothing in the data-ga guide about anchor menus, but it looks like data-section on main ASU websites is "on this page" so I will update that. I think everything else is ok? |
|
@zainabD Yes all the custom sticky functions are removed, the UDS JS file handles all of that functionality now. I tested on theme main v2.3.0 and dev v2.3.1 and it works as expected without a sticky class. Do you mean it's not working as expected, or you were expecting a sticky class but it is working? |
|
@jkcox it's not working as expected. I will run another test again and update my review. |
|
@jkcox Regarding the |
|
I tested this again locally on a CORES copy site pulled from https://cores.research.qa.rtd.asu.edu/. I ensured that no HFCM was active that could affect the anchor menu, and the UDS theme was set to the main branch at v2.3.0. I had to click "Attempt Recovery" to fix the block. After doing so, the anchor menu is not remaining sticky while scrolling. |
|
I switched it to develop v2.3.1 and it is working on https://cores.research.qa.rtd.asu.edu/our-impact/ I think it needs the global bootstrap file. It might have been cached on my local. |
|
Were you able to pull your branch through git updater on https://cores.research.qa.rtd.asu.edu/ ? |
|
@zainabD In my local testing, I had to set my theme to the |
zainabD
left a comment
There was a problem hiding this comment.
Retested locally on a CORES copy site pulled from https://cores.research.qa.rtd.asu.edu/. Ensured no HFCM was active that could affect the anchor menu, and the UDS theme was set to the develop branch at v2.3.1. The anchor menu is working as expected.
Before merging this update to main, please make sure of the following:
- Update the UDS theme main branch to v2.3.1.
- Make a list of all web pages that contain the anchor menu prior to merging, so that immediately after the update is applied, we can go through each page and click "Attempt Recovery" to ensure the menu renders correctly with no issues.
Approved.
wmcconnell
left a comment
There was a problem hiding this comment.
Testing: Local WordPress
Theme: 2.3.1 (tested on Develop for compatibility)
Functional testing showed no issues. In fact, the updated anchor menu improves our current situation with updated scrolling behavior (maybe due to Bootstrap changes) that does not overshoot the anchors; although it's not always consistent.
Multiple anchor menus created during testing; no issues with adding, removing, and editing of items, etc. We are aware of issues with backwards compatibility, so we know we will need to handle that.
I mentioned in the discussion what is hopefully an edge case regarding highlighting of anchor menu items when jumping all the way to the last one from the top of the page. As I mentioned in that discussion, I'm not sure this is even something we can fix, as it probably comes from the Unity Bootstrap JS file. There is a work-around involving increased space between the items, and this issue does not affect the functionality of the links - just the highlighting of the current item.


firstElementId undefined
modified component in asu-unity-stack - removed sticky functions
Update
save.jsto output the exact UDS Bootstrap HTML structure per docs:#uds-anchor-menu, Bootstrap collapse<h2>with chevron<span>,<a class="nav-link">items with all GA attributes, icon as<span class="fas fa-X">Clear
frontend.js— Unity Bootstrap Theme JS (already loaded viaunityblocks-anchor-menu-view-script) handles all behavior automatically when#uds-anchor-menuis in the DOM