Implement collection of items with nested interactive elements
See original GitHub issue- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
Putting a TextField with a label in a Menu and then typing the the first character of the label causes the focus to change. Typing any other character does not produce this behavior. This seems to always be happen for any label.
Expected Behavior 🤔
The focus should not change.
Steps to Reproduce 🕹
https://codesandbox.io/s/basicmenu-material-demo-forked-gyq9n?file=/demo.js
Steps:
- Click to open the menu
- Type
i
(the first character of the label) and the focus automatically changes. - Close and reopen the menu.
- Type any other character and the focus does not change
Context 🔦
Your Environment 🌎
`npx @mui/envinfo`
System:
OS: macOS 11.6
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 4.13 GB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 12.22.1 - ~/.nvm/versions/node/v12.22.1/bin/node
npm: 6.14.12 - ~/.nvm/versions/node/v12.22.1/bin/npm
Managers:
Homebrew: 3.2.3 - /usr/local/bin/brew
pip2: 18.1 - /usr/local/bin/pip2
pip3: 21.1.3 - /usr/local/bin/pip3
RubyGems: 3.0.3 - /usr/bin/gem
Utilities:
Make: 3.81 - /usr/bin/make
GCC: 4.2.1 - /usr/bin/gcc
Git: 2.30.1 - /usr/bin/git
Clang: 13.0.0 - /usr/bin/clang
Servers:
Apache: 2.4.48 - /usr/sbin/apachectl
Nginx: 1.21.0 - /usr/local/bin/nginx
Virtualization:
Docker: 20.10.8 - /usr/local/bin/docker
SDKs:
iOS SDK:
Platforms: iOS 15.0, DriverKit 20.4, macOS 11.3, tvOS 15.0, watchOS 8.0
IDEs:
Nano: 2.0.6 - /usr/bin/nano
Vim: 8.2 - /usr/bin/vim
WebStorm: 2021.2.2
Xcode: 13.0/13A233 - /usr/bin/xcodebuild
Languages:
Bash: 3.2.57 - /bin/bash
Perl: 5.30.2 - /usr/bin/perl
PHP: 7.3.29 - /usr/bin/php
Python: 2.7.16 - /usr/bin/python
Python3: 3.9.6 - /usr/local/bin/python3
Ruby: 2.6.3 - /usr/bin/ruby
Databases:
PostgreSQL: 13.3 - /usr/local/bin/postgres
SQLite: 3.32.3 - /usr/bin/sqlite3
Browsers:
Chrome: 94.0.4606.61
Firefox: 92.0
Safari: 15.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
nested-interactive - Accessibility Insights
Ensure interactive controls don't have focusable descendants by separating nested interactive components or styling a single element.
Read more >Fix Nested Interactive Components in Prototypes | Figma Bites
In this video we teach you a way to fix nested interactive components inside prototypes. When building prototypes that include nested ...
Read more >[nested-interactive] fails also for not interactive nested elements
It fails with a violation of nested-interactive . Motivation: The div is in reality a custom element to replace an actual button. However,...
Read more >How to Create Interactive Design with a Nested Component in ...
Best practice is to have nested component as a symbol. Select menu_group and make it a symbol. Now select your new symbol, and...
Read more >Accessible nested button inside button? - html - Stack Overflow
Preword. Don't nest interactive elements. There is a reason that it isn't valid HTML to nest buttons or hyperlinks, it causes nightmares for ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ypahalajani Thanks for debugging it. Can confirm
menu
variant works.I think one pattern I’ve seen a couple of times is editable items. For example, in TODO-list apps you have a list of TODO items, whose content you want to edit. In this UI you can basically switch between “selection” and “editing” modalities. But our Menu currently always assumes “selection modality”.
~It seems to me we should allow nested interactive elements to support this use cases even though this opens the door of potentially confusing UIs.~
Though a Menu is not really the UI I’m talking about. It’s more like Listbox. A Menu is really just a collection of action items. So this may come down to implementing a proper Listbox component that supports these patterns.