-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: prevent disabled Show in Playlist menu item from triggering actions #4356
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
Conversation
Fixed bug where clicking on the disabled 'Show in Playlist' menu item would unintentionally trigger music playback and replace the queue. The menu item now properly prevents event propagation when disabled and takes no action. This resolves the issue where users would accidentally start playing music when clicking on the greyed-out menu option. The fix includes: - Custom onClick handler that stops event propagation for disabled state - Proper styling to maintain visual disabled state while allowing event handling - Comprehensive test coverage for the disabled behavior
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.
Summary of Changes
Hello @deluan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request resolves a critical UI bug where a disabled context menu item could inadvertently trigger application-wide side effects. The changes ensure that user interactions with disabled elements behave as expected, preventing unintended music playback or queue modifications, thereby improving the overall stability and user experience of the application.
Highlights
- Bug Fix for Disabled Menu Item: Addressed an issue where clicking a disabled 'Show in Playlist' menu item in the song context menu would still trigger unintended actions like music playback or queue replacement.
- Event Propagation Control: Implemented a conditional
onClick
handler for the 'Show in Playlist' menu item. When disabled (i.e., no playlists exist), the handler now explicitly callse.stopPropagation()
to prevent unintended actions. - Styling for Disabled State: Applied
pointerEvents: 'auto'
style to the disabled menu item to ensure that click events are still captured and can be explicitly handled, despite the default browser behavior for disabled elements. - Comprehensive Test Coverage: Added a new test case to verify that the 'Show in Playlist' menu item correctly does nothing when it is disabled due to the absence of playlists.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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
This PR fixes a bug where clicking on a disabled "Show in Playlist" menu item would unintentionally trigger music playback and replace the queue. The fix ensures that disabled menu items properly prevent event propagation and take no action when clicked.
Key changes:
- Added custom onClick handler for disabled "Show in Playlist" menu items that stops event propagation
- Updated styling to maintain visual disabled state while allowing proper event handling
- Added comprehensive test coverage for the disabled behavior
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
ui/src/common/SongContextMenu.jsx | Implements the fix by adding conditional onClick handler and styling for disabled "Show in Playlist" menu items |
ui/src/common/SongContextMenu.test.jsx | Adds test coverage for the disabled menu item behavior and refactors existing test mocks |
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.
Code Review
This pull request effectively resolves a bug where a disabled menu item was still triggering actions. The approach of using a custom onClick
handler to stop event propagation combined with pointer-events: 'auto'
is a solid solution. I've made a couple of minor suggestions in SongContextMenu.jsx
to improve code conciseness and avoid unnecessary object creation.
Simplified the arrow function for disabled onClick handler and changed inline style from empty object to undefined when not needed. Also added a CSS class for disabled menu items for potential future use. These changes improve code readability and follow React best practices by using undefined instead of empty objects for conditional styles.
f1f77bf
to
6f1db40
Compare
Description
Fixed a bug where clicking on the disabled "Show in Playlist" menu item would unintentionally trigger music playback and replace the queue. The menu item now properly prevents event propagation when disabled and takes no action.
Related Issues
Fixes #4355
Type of Change
Checklist
Please review and check all that apply:
How to Test
Screenshots / Demos (if applicable)
Screen.Recording.2025-07-17.at.10.16.00.AM.mov
Additional Notes
The fix includes:
The solution ensures that disabled menu items behave as expected - they do nothing when clicked instead of triggering unintended actions.