Skip to content
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

🐛 [BUG] - ActionMenu ignores items whose value is falsy #906

Open
victoriaNine opened this issue Jan 24, 2025 · 0 comments
Open

🐛 [BUG] - ActionMenu ignores items whose value is falsy #906

victoriaNine opened this issue Jan 24, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@victoriaNine
Copy link

victoriaNine commented Jan 24, 2025

Describe the bug

In the ActionMenu component, selection is ignored if the item's value is falsy (including here where it's intentionally 0). I understand we might have wanted this check to filter out invalid items so, if kept, maybe checking newValue against undefined instead would do? We might intentionally want to use null or false as values.

This is currently non-blocking for my use case since I'm working with numeric values (see ugly temp workaround below), but it might be different for a user who needs to use null or false for example. Thanks.

onToggle(String(+newValue - 1))

...

<ActionMenu.Item value={item.value + 1} ... />

Reproduction steps

1. Setup an `ActionMenu` component with two items: one whose value is falsy (including but not limited to `undefined`), the other not.
2. Open the browser and attempt to select the first item in the menu
3. Observe that it cannot be selected

Expected behavior

`ActionMenu` items should be selectable even if they have a falsy value, unless it is specifically `undefined`.

Screenshots

CleanShot.2025-01-24.at.13.50.53.mp4

Browsers

Chrome

OS

Mac

@victoriaNine victoriaNine added the bug Something isn't working label Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant