Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
225 views
in Technique[技术] by (71.8m points)

javascript - css position absolute making the textbox go down

  • I build a prototype using chips material-UI.
    • When I click the Test IPA the textbox should show immediately below the text Test IPA.
    • In the prototype, it shows immediately below but whereas when I include with other functionalities, it's showing at the bottom.
  • I debugged the CSS, its due to position absolute for each scenario it's showing different values and its coming from material UI.
  • Can you tell me how to fix it with respect to other components?
  • Providing my code snippet, sandbox and bug screenshot below.

Problem with other components https://codesandbox.io/s/qqqk23x3q

enter image description here

Working properly individually https://codesandbox.io/s/1y2mvo0ol3

JSX:

<td>
    <ChipsTextbox chipName="test IPA" />
</td>

<Menu id="simple-menu" open={open} onClose={this.handleClose}>
    <TextField onChange={this.onChange} onKeyDown={this.handleKeyPress} />
</Menu>

CSS:

.MuiPopover-paper-1706 {
    outline: none;
    position: absolute;
    min-width: 16px;
    max-width: calc(100% - 32px);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 16px;
    max-height: calc(100% - 32px);
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The parent element of the .MuiPopover-paper-1706 should have position: relative CSS attribute. If it doesn't then the element with position: absolute will be positioned relatively to the nearest parent with relative positioning.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...