-
Notifications
You must be signed in to change notification settings - Fork 14
fix: add documented events to menu-button #219 #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Adds documented menu-button-level events for select/change, aligning event listeners with the menu-button widget rather than the underlying menu element.
Changes:
- Adds a dedicated handler for
"makeup-menu-change"and dispatches"makeup-menu-button-change". - Dispatches
"makeup-menu-button-select"on select and refactors collapse/focus logic into a shared helper. - Updates docs example to listen on
widget.elfor the documented menu-button events.
Reviewed changes
Copilot reviewed 2 out of 6 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/ui/makeup-menu-button/src/index.js | Splits change vs select handling, dispatches documented menu-button events, and centralizes collapse behavior. |
| docs/ui/makeup-menu-button/index.js | Updates example listeners to the new menu-button event targets/types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| this.menu.el.removeEventListener("makeup-menu-change", this._onMenuItemChangeListener); | ||
| } | ||
|
|
||
| // this should maybe be moved to expander as an option callback for after collapse |
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is speculative and not actionable as-is. Consider converting it into a tracked TODO (ideally referencing an issue) or removing it once a decision is made, so the codebase doesn’t accumulate ambiguous guidance.
| // this should maybe be moved to expander as an option callback for after collapse | |
| // TODO: Move this logic to Expander as an option callback that runs after collapse. |
| _collapseMenuAfterTimeout() { | ||
| const widget = this; | ||
|
|
||
| setTimeout(function () { | ||
| widget._expander.expanded = false; | ||
| widget._buttonEl.focus(); | ||
| }, 150); | ||
| } |
Copilot
AI
Feb 8, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The timeout duration 150 is a magic number and the const widget = this pattern makes the helper harder to read/maintain. Consider extracting the delay into a named constant (e.g., COLLAPSE_DELAY_MS) and using an arrow function in setTimeout so this can be used directly.
|
At first, I wondered why the menu collapses on change. Looking closer, |
Fixes #219