You can not change the default `anchorOrigin.vertical` value ์˜ค๋ฅ˜

์‚ฌ์šฉํ•œ ์ฝ”๋“œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

<Menu
  anchorEl={anchorEl}
  getContentAnchorEl={null} // ์ด ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ์–ด์•ผํ•œ๋‹ค.
  keepMounted
  anchorOrigin={{
  vertical: 'bottom', // ์ด๋ ‡๊ฒŒ ์กฐ์ •ํ•˜๋ ค๋ฉด getContentAnchorEl์„ settingํ•ด์ฃผ์–ด์•ผํ•จ
  horizontal: 'left',
  }}
  open={anchorEl !== null}
  onClose={handleClose}
  className="color-picker"
>
  {
  	colorArr.map(...)
  }
</Menu>

 

ํ•ด๋‹น ์ฝ”๋“œ๋Š” ์ •์ƒ๋™์ž‘ํ•˜์ง€๋งŒ, ํ‘œ์‹œ๋œ getContentAnchorEl์„ ์†์„ฑ์œผ๋กœ ์„ค์ •ํ•˜์ง€ ์•Š์œผ๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์˜ค๋ฅ˜๊ฐ€ ๋œฌ๋‹ค.

Material-UI: You can not change the default `anchorOrigin.vertical` value 
when also providing the `getContentAnchorEl` prop to the popover component.
Only use one of the two props.
Set `getContentAnchorEl` to `null | undefined` or leave `anchorOrigin.vertical` unchanged.

 

material-ui์˜ popover ์ปดํฌ๋„ŒํŠธ API๋ฅผ ์‚ดํŽด๋ณด์•˜๋‹ค.

material-ui.com/api/popover/#popover-api

 

Popover API - Material-UI

The API documentation of the Popover React component. Learn more about the props and the CSS customization points.

material-ui.com

API์—์„œ getContentAnchorEl์€ content anchor element๋ฅผ ๊ฒ€์ƒ‰ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋˜๋ฉฐ, content anchor element๋Š” anchor element ๋ฐ”๋กœ ์œ„์— ์œ„์น˜ํ•œ๋‹ค๊ณ  ํ•œ๋‹ค.

๋”ฐ๋ผ์„œ null๋กœ ๋“ฑ๋กํ•ด์ฃผ๋ฉด ๊ธฐ์กด์— anchorEl ์†์„ฑ์œผ๋กœ ๋“ฑ๋กํ•œ anchor element๊ฐ€ ์œ„์น˜์˜ ๊ธฐ์ค€์ด ๋˜๋ฉด์„œ popover์˜ ์œ„์น˜๊ฐ€ ์ œ๋Œ€๋กœ ์žกํžŒ๋‹ค.

 

 

๋ฐ˜์‘ํ˜•