Skip to content

fix: prevent axis attribute menu from appearing offscreen [CODAP-1048]#2300

Merged
kswenson merged 3 commits intomainfrom
CODAP-1048-axis-attribute-menu
Jan 19, 2026
Merged

fix: prevent axis attribute menu from appearing offscreen [CODAP-1048]#2300
kswenson merged 3 commits intomainfrom
CODAP-1048-axis-attribute-menu

Conversation

@kswenson
Copy link
Copy Markdown
Member

@kswenson kswenson commented Jan 19, 2026

[CODAP-1048] Impossible to choose attribute from a graph axis menu when list is very long
[CODAP-503] Graph Attribute Menu clipped by window problem

Summary

  • Wrap MenuList in a Chakra UI Portal so it renders at the .codap-container level, allowing Popper to properly calculate viewport boundaries for positioning
  • Add placement="auto" to let Popper choose the optimal menu position based on available space
  • Remove the spacer MenuItem hack that was previously needed to prevent the bottom item from disappearing (no longer necessary with Portal-based rendering)
  • Portal the menu into .codap-container instead of body to prevent it from appearing on top of the tool shelf and CFM menus
  • Add z-index styling to ensure the menu appears above tiles within the container
  • Make the menu scrollable with a max height of min(50vh, 400px) to handle long attribute lists

Test plan

  • Open a graph with attributes on X and Y axes
  • Position the graph near the bottom of the browser window and click on the X axis attribute - menu should appear above the axis if there is not enough room below
  • Position the graph near the bottom of the browser window and click on the Y axis attribute - menu should flip to appear in a visible location
  • Verify the bottom menu item (Treat as Categorical/Numeric) is visible and not cut off in both cases
  • Test with graphs in various positions to ensure menus always appear within the visible viewport
  • Verify the menu does not appear on top of the tool shelf or CFM menu bars
  • Test with a dataset containing many attributes to verify the menu is scrollable

🤖 Generated with Claude Code

Wrap MenuList in a Portal so it renders at the document body level,
allowing Popper to properly calculate viewport boundaries for positioning.
Add placement="auto" to let Popper choose the optimal menu position based
on available space.

These changes also fix a Chakra UI issue where the bottom menu item would
sometimes disappear, so the spacer MenuItem hack has been removed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kswenson kswenson changed the title fix: prevent axis attribute menu from appearing offscreen fix: prevent axis attribute menu from appearing offscreen [CODAP-1048] Jan 19, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.71%. Comparing base (98bcf2b) to head (7bfa795).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2300      +/-   ##
==========================================
+ Coverage   86.69%   86.71%   +0.02%     
==========================================
  Files         724      724              
  Lines       38770    38771       +1     
  Branches     9588     9596       +8     
==========================================
+ Hits        33610    33620      +10     
+ Misses       5151     4847     -304     
- Partials        9      304     +295     
Flag Coverage Δ
cypress 71.85% <100.00%> (+0.07%) ⬆️
jest 55.74% <15.38%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cypress
Copy link
Copy Markdown

cypress Bot commented Jan 19, 2026

codap-v3    Run #9677

Run Properties:  status check passed Passed #9677  •  git commit 48d43bc376: Increment the build number
Project codap-v3
Branch Review main
Run status status check passed Passed #9677
Run duration 02m 08s
Commit git commit 48d43bc376: Increment the build number
Committer eireland
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
View all changes introduced in this branch ↗︎

Copy link
Copy Markdown
Contributor

Copilot AI left a 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 a longstanding issue where graph axis attribute menus would appear offscreen when the graph was positioned near the bottom of the browser window or when attribute lists were very long.

Changes:

  • Wraps the MenuList component in a Chakra UI Portal to render it at document body level
  • Changes Menu positioning from boundary="scrollParent" to placement="auto" for automatic optimal positioning
  • Removes the spacer MenuItem hack that was previously needed to prevent bottom items from being cut off

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
v3/src/components/axis/components/axis-or-legend-attribute-menu.tsx Wraps MenuList in Portal and updates Menu props for proper viewport-aware positioning
v3/cypress/support/elements/axis-elements.ts Updates test selector to find menu items at body level instead of within graph tile

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread v3/cypress/support/elements/axis-elements.ts Outdated
Comment thread v3/cypress/support/elements/axis-elements.ts Outdated
The MenuList is now rendered via Portal at the document body level,
so the test helper needs to find menu items globally rather than
inside the axis menu parent element.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kswenson kswenson force-pushed the CODAP-1048-axis-attribute-menu branch from 06ae17f to d9ac133 Compare January 19, 2026 20:01
@kswenson kswenson requested a review from Copilot January 19, 2026 20:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@kswenson kswenson requested review from bfinzer and removed request for bfinzer January 19, 2026 20:15
@kswenson kswenson marked this pull request as draft January 19, 2026 20:18
Portal the axis attribute menu into .codap-container instead of body
to prevent it from appearing on top of the tool shelf and CFM menus.
Add z-index to ensure menu appears above tiles. Make menu scrollable
with max height of min(50vh, 400px) to handle long attribute lists.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kswenson kswenson requested a review from Copilot January 19, 2026 20:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread v3/cypress/support/helpers/axis-helper.ts
Comment thread v3/src/components/axis/components/axis-or-legend-attribute-menu.tsx
@kswenson kswenson marked this pull request as ready for review January 19, 2026 21:17
@kswenson kswenson requested a review from bfinzer January 19, 2026 21:18
Copy link
Copy Markdown
Contributor

@bfinzer bfinzer left a comment

Choose a reason for hiding this comment

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

👍🏻LGTM
Nice use of portal and bringing about scrolling!

@kswenson kswenson merged commit 8f37049 into main Jan 19, 2026
20 of 21 checks passed
@kswenson kswenson deleted the CODAP-1048-axis-attribute-menu branch January 19, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants