Comments (4)
Duplicate of #36133.
Also related to #19116, #19096.
Preventing bubbling of keyboard event works: https://codesandbox.io/p/sandbox/sweet-moon-hyytgh.
from material-ui.
Have you tried using Popover instead of menu ?
Check this example with popover and it is working fine - https://codesandbox.io/p/sandbox/charming-architecture-8xmh5m
Is there any specific use case of using menu ?
from material-ui.
Have you tried using Popover instead of menu ?
Check this example with popover and it is working fine - https://codesandbox.io/p/sandbox/charming-architecture-8xmh5m
Is there any specific use case of using menu ?
Thanks for reply, but the sandbox is not found!
I checked using the popover and it works fine.
from material-ui.
@ako-v damn...
My codesandbox account reached at maximum sharable links.
import { useState } from "react";
import Autocomplete from "@mui/material/Autocomplete";
import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button";
import Popover from "@mui/material/Popover";
import Box from "@mui/material/Box";
import "./styles.css";
import { Typography } from "@mui/material";
export default function App() {
const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const open = Boolean(anchorEl);
const handleOpen = (event: React.MouseEvent<HTMLButtonElement>) => {
setAnchorEl(event.currentTarget);
};
const handleClose = () => {
setAnchorEl(null);
};
return (
<div className="App">
<Box p={1} width={500}>
<Typography>This one works fine</Typography>
<Autocomplete
id="autocomplete-demo"
options={[
{ label: "Option 1", value: 1 },
{ label: "Moption 2", value: 2 },
{ label: "TOption 3", value: 3 },
{ label: "SOption 4", value: 4 },
{ label: "KOption 5", value: 5 },
{ label: "ROption 6", value: 6 },
{ label: "LOption 7", value: 7 },
{ label: "NOption 8", value: 8 },
{ label: "ZOption 9", value: 9 },
]}
multiple
renderInput={(params) => (
<TextField
{...params}
label="Multiple values"
placeholder="Favorites"
/>
)}
/>
</Box>
<Box p={1} mt={2}>
<Typography>
Open the dropdown and if you type <strong>m</strong> as the first
letter, it will close the autocomplete, because it is the first letter
of the label (Multiple values)
</Typography>
<Button onClick={handleOpen}>Open Dropdoewn</Button>
<Popover
open={open}
anchorEl={anchorEl}
onClose={handleClose}
anchorOrigin={{
vertical: "bottom",
horizontal: "left",
}}
>
<Box padding={1} width={500}>
<Autocomplete
id="autocomplete-demo1"
options={[
{ label: "Option 1", value: 1 },
{ label: "Moption 2", value: 2 },
{ label: "TOption 3", value: 3 },
{ label: "SOption 4", value: 4 },
{ label: "KOption 5", value: 5 },
{ label: "ROption 6", value: 6 },
{ label: "LOption 7", value: 7 },
{ label: "NOption 8", value: 8 },
{ label: "ZOption 9", value: 9 },
]}
multiple
renderInput={(params) => (
<TextField
{...params}
label="Multiple values"
placeholder="Favorites"
/>
)}
/>
</Box>
</Popover>
</Box>
</div>
);
}
from material-ui.
Related Issues (20)
- [docs-infra] Scoped notification per product HOT 3
- [material-ui][Autocomplete] Allow the user to remove the textarea warning
- [docs-infra] Investigate the report of web vitals
- [material-ui][Autocomplete] Using limitTags prevents clicking buttons outside of autocomplete while autocomplete is focused HOT 3
- Issue with createGenerateClassName HOT 2
- Spaces getting trimmed inside label in Chips | Expectation is to see labels exactly as passed HOT 2
- [pigment-css] Box does not create styles HOT 1
- [material-ui][Select] "Property 'muiName' does not exist" on Select HOT 4
- [material-ui][Dark mode] how to use nextjs app directories and material-ui to set up dark mode, not pages directories HOT 1
- [colorManipulator] Support the `oklch` color notation HOT 1
- [colorManipulator] Alpha function not working with the `hsl()` notation HOT 2
- [pigment-css][react] throws errors in non-browser environment (i.e. unsafe when referenced) HOT 13
- [joy-ui][Input] Input element `onChange` nested in MenuItem does not fire. HOT 1
- [joy-ui] How to adjust theme spacing with HTML font-size: 10px HOT 2
- [joy-ui][Checkbox] Not using the correct font in the Next.js example HOT 6
- [material-ui][Slider] Sometimes the value in onChange and the value in onChangeCommitted are output differently HOT 1
- [material-ui][Tooltip] enterDelay prop resets timer on every child mouseOver event
- [joy-ui][FormControl] Label is being displayed above the input HOT 2
- [icons] Add a drone icon HOT 4
- Same code in both JS and TS variants for multiple components on mui docs HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from material-ui.