Skip to content

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

Merged
merged 2 commits into from
Jul 17, 2025

Conversation

deluan
Copy link
Member

@deluan deluan commented Jul 17, 2025

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

  • Bug fix
  • New feature
  • Documentation update
  • Refactor
  • Other (please describe):

Checklist

Please review and check all that apply:

  • My code follows the project's coding style
  • I have tested the changes locally
  • I have added or updated documentation as needed
  • I have added tests that prove my fix/feature works (or explain why not)
  • All existing and new tests pass

How to Test

  1. Load a list of songs from either album view or artist view
  2. Find a track not already added to a playlist and click on the 3-dot menu for that track
  3. Click on the greyed-out "Show in Playlist" option
  4. Verify that nothing happens (no music plays, no queue replacement)

Screenshots / Demos (if applicable)

Screen.Recording.2025-07-17.at.10.16.00.AM.mov

Additional Notes

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

The solution ensures that disabled menu items behave as expected - they do nothing when clicked instead of triggering unintended actions.

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
@Copilot Copilot AI review requested due to automatic review settings July 17, 2025 14:13
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 calls e.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

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

Copy link
Contributor

@Copilot 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 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

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.
@deluan deluan force-pushed the fix/inactive-show-in-playlist-menu-item branch from f1f77bf to 6f1db40 Compare July 17, 2025 14:37
@deluan deluan merged commit 445880c into master Jul 17, 2025
35 checks passed
@deluan deluan deleted the fix/inactive-show-in-playlist-menu-item branch July 17, 2025 15:00
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.

[Bug]: Clicking on the inactive "Show in Playlist" option plays the song and replaces the play queue
1 participant