Skip to content

Commit

Permalink
fix(material/form-field): ensure same stacking context as container
Browse files Browse the repository at this point in the history
When `will-change` was removed in #27251, the form field lost its implicit stacking context which means that some of its descendants may be stacked on top of the container.

These changes add an explicit `z-index` on the container to resolve the issue.

Fixes #28708.
  • Loading branch information
crisbeto committed Mar 12, 2024
1 parent 9509ad5 commit 4fe3424
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/material/form-field/form-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ $_icon-prefix-infix-padding: 4px;
min-width: 0;
// To avoid problems with text-align.
text-align: left;
// Avoids stacking issues due to the absolutely-positioned
// descendants of the form field (see #28708)
position: relative;
z-index: 0;

[dir='rtl'] & {
text-align: right;
Expand Down Expand Up @@ -139,7 +143,7 @@ $_icon-prefix-infix-padding: 4px;
// MDC applies `pointer-events: none` to the `.mdc-text-field--disabled`. This breaks clicking on
// prefix and suffix buttons, so we override `pointer-events` to always allow clicking.
pointer-events: auto;
// Needs a z-index to ensure it's on top of other content clickable. See #27043.
// Needs a z-index to ensure it's on top of other clickable content. See #27043.
position: relative;
z-index: 1;

Expand Down

0 comments on commit 4fe3424

Please sign in to comment.