-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[Autocomplete] Custom Popper with "Action Option" keyboard support #45224
Comments
@mogrady88 Instead of preventDefault(), does this work: event.defaultMuiPrevented = true; |
Hey @mj12albert that doesnt work either unfortunately. I wasnt sure if this was due to any |
For reference there is this codesandbox that's got a similar setup to mine. Pressing |
Hey @mogrady88, thanks for the report! Sadly, this is not supported at the moment, similar to the Select component #26356. I added the In the meantime, if you or anyone is trying to find a workaround, I would recommend looking at Autocomplete's implementation, mimicking the Popper and its children's structure, and using |
Ok, thank you Diego! Ill take a look the workaround in the meantime |
Hey,
I'm trying to implement an
Autocomplete
with a customPopper
and an "action Item" at the top of the list. The "action item" is aListItemButton
. This renders just fine, which is great, but I'm running into issues trying to add keyboard support to this implementation. The user should be able toTab
to the "action item" in order to interact with it but when I pressTab
theAutocomplete
closes.I have not found any way to keep the menu open when I press the
Tab
key. Do you have any ideas on how I could achieve this?Implementation:
![Image](https://private-user-images.githubusercontent.com/35465181/410089671-91b2d481-c481-4cbb-851b-2e24c218dd60.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NDAxOTgsIm5iZiI6MTczODkzOTg5OCwicGF0aCI6Ii8zNTQ2NTE4MS80MTAwODk2NzEtOTFiMmQ0ODEtYzQ4MS00Y2JiLTg1MWItMmUyNGMyMThkZDYwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDE0NTEzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRkYjdlMGM3NzliM2YzMWRkMWRmNzJiMzFhNTUwMGIxZTM5YTY1NmNiZmZiNDgxMmJmYWFiNDEwYWYwYjcwNDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.Gn8zRgmNmPvC_9G5AlPNnag-OEr1mln3rrf8fsK6LMs)
Popper Code:
![Image](https://private-user-images.githubusercontent.com/35465181/410070059-6ff8f179-e1ad-4e10-8e24-f39358ea708d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NDAxOTgsIm5iZiI6MTczODkzOTg5OCwicGF0aCI6Ii8zNTQ2NTE4MS80MTAwNzAwNTktNmZmOGYxNzktZTFhZC00ZTEwLThlMjQtZjM5MzU4ZWE3MDhkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDE0NTEzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgxMDVkYmMzNTI4OWNjNmY5ZGNhODRkYWM2MjJiNzNkNTgxMTNlZjEyZGM1YzY5NjYwOGUyNzdhZmE3Mzg2MzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.VjEOL_pODMAsuoo_X9bruzFkV9KqkSmw14rr4uYSrf8)
onKeyDown Handler Code (
![Image](https://private-user-images.githubusercontent.com/35465181/410092814-982baf63-4db0-4e75-b068-8097ceb585ee.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NDAxOTgsIm5iZiI6MTczODkzOTg5OCwicGF0aCI6Ii8zNTQ2NTE4MS80MTAwOTI4MTQtOTgyYmFmNjMtNGRiMC00ZTc1LWIwNjgtODA5N2NlYjU4NWVlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDE0NTEzOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc2ODExMGQ2NGY3N2VhYTE2MjlkMjI3ZTEzMzk5ZmIzODY5MDcyMWMwNmEzOGZiNzRhYjBkN2U0MTJkMjU2MWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.9z6s6PIo3OTOPML8r-zainGEMpQhl_R_gSII_qwnbS8)
handleBaseKeyDown
is mapped to theonKeyDown
prop onAutocomplete
):Search keywords:
The text was updated successfully, but these errors were encountered: