question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Read-only menu items

See original GitHub issue

It would be great if we could add a read-only menu item, for example to show a status, version number, or other static info. A read-only menu item should not be selectable and it should not close the menu when the user clicks or presses enter on it.

The existing readOnly prop might be used for this functionality. The disabled prop could work too, but it doesn’t cover the purpose as nicely. Currently, these props simply get passed on to the rendered span, where they don’t have any effect on the behavior of the menu item.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
shirshendubhowmickcommented, Aug 8, 2020

I agree there should be a disabled option natively supported by the library. However can’t promise a specific date when we will be able to implement that. Currently there are lot a of things going on to improve in the library related to the legacy code.

I have added this feature to the product roadmap https://github.com/davidtheclark/react-aria-menubutton/projects/1

Hopefully will be implemented in sometime.

0reactions
speecommented, Aug 7, 2020

Thanks for your replies and sample, @shirshendubhowmick. I understand I could check if a selected item should be handled, but my idea about supporting read-only items would be that the library checks this before calling the selection handler in the first place. It would also eliminate these items from the focus cycle.

In fact, as #67 shows, including an element other than a MenuItem results in this exact behavior.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML attribute: readonly - HTML: HyperText Markup Language
The Boolean readonly attribute, when present, makes the element not mutable, meaning the user can not edit the control.
Read more >
HTML form readonly SELECT tag/input - javascript
This finds all select elements with a readonly attribute, then finds all options inside those selects that are not selected, then it hides...
Read more >
MenuItem ReadOnly Property `type` · Issue #4097
When you try to change a menu items type, it won't let you... how do you? Uncaught Exception: TypeError: Cannot assign to read...
Read more >
Context Menu in Read Only Texbox - MSDN - Microsoft
Since the only thing you can do with a ReadOnly textbox is copy , the user has to select some text and then...
Read more >
HTML DOM Input Text readOnly Property
The readOnly property sets or returns whether a text field is read-only, or not. A read-only field cannot be modified. However, a user...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found