2021年4月6日星期二

material ui select, how to see the event and focus the select when the input is clicked?

i'm using this select:

<FormControl variant='standard' className={classes.formControl} onClick={divOnClick}>                                    <Select                      labelId="demo-simple-select-label"                      id="demo-simple-select"                      defaultValue=""                      onChange={(e) => {console.log("test");}}                      onClick={(e) => {console.log("test");}}                      displayEmpty                    >                      <MenuItem value="" disabled>                        Seleziona data                      </MenuItem>                      <MenuItem value={10}>Ten</MenuItem>                      <MenuItem value={20}>Twenty</MenuItem>                      <MenuItem value={30}>Thirty</MenuItem>                    </Select>                  </FormControl>  

as you can see I've tried everything but I can't see when the select input is clicked and the Menu appears. How can I see the event? Also, I need to trigger the focus on the select when the select input is clicked in order to call the focus:within of the parent container (because now the focus is triggered when the MenuItem is clicked...), how this is possible? Thank you very much

https://stackoverflow.com/questions/66978284/material-ui-select-how-to-see-the-event-and-focus-the-select-when-the-input-is April 07, 2021 at 09:01AM

没有评论:

发表评论