Skip to content

Simplify Menu DOM#7292

Merged
acelaya merged 1 commit intomainfrom
simplify-menu
Sep 15, 2025
Merged

Simplify Menu DOM#7292
acelaya merged 1 commit intomainfrom
simplify-menu

Conversation

@acelaya
Copy link
Copy Markdown
Contributor

@acelaya acelaya commented Sep 15, 2025

This is an intermediary step part of hypothesis/product-backlog#1660

This PR reduces the amount of nested DOM elements in Menu and GroupList, so that it is possible to make the group name truncate as much as the horizontal space allows, without affecting other elements.

This PR does not yet solve the issue in hypothesis/product-backlog#1660, and should not produce any visual changes.

Tip

This PR is easier to review hiding whitespaces

<span
className={classnames(
// Add some vertical padding so that the dropdown has some space
'py-1',
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This padding has been moved to one of the children, making this wrapper no longer needed.

Comment on lines -205 to -206
// wrapper is needed to serve as the flex layout for the label and indicator content.
className="flex items-center gap-x-1"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It turns out this wrapper is actually not needed, as the button itself is already a flex container. Only the gap-x-1 had to be set there.

Comment on lines +227 to +238
const img = mount(<div>{label}</div>).find('img');
assert.equal(img.prop('src'), 'test-icon');
});

it('does not render an icon if the the publisher-provided icon is missing', () => {
const wrapper = createGroupList();
const label = wrapper.find('Menu').prop('label');
assert.isFalse(mount(label).find('img').exists());
assert.isFalse(
mount(<div>{label}</div>)
.find('img')
.exists(),
);
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The label is now a fragment, so it needs to be wrapped in an element to allow mounting.

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.46%. Comparing base (5b9f2f7) to head (e2f8d82).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7292   +/-   ##
=======================================
  Coverage   99.46%   99.46%           
=======================================
  Files         271      271           
  Lines       10930    10930           
  Branches     2614     2614           
=======================================
  Hits        10872    10872           
  Misses         58       58           

☔ 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.

Copy link
Copy Markdown
Contributor

@robertknight robertknight left a comment

Choose a reason for hiding this comment

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

Looks fine from a brief test.

@acelaya acelaya mentioned this pull request Sep 15, 2025
3 tasks
@acelaya acelaya merged commit e1ee0df into main Sep 15, 2025
4 checks passed
@acelaya acelaya deleted the simplify-menu branch September 15, 2025 10:23
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.

2 participants