Skip to content

Commit

Permalink
fix(material/form-field): allow clicking on floating label (#26110)
Browse files Browse the repository at this point in the history
* fix(material/form-field): allow clicking on floating label

* fixup! fix(material/form-field): allow clicking on floating label
  • Loading branch information
mmalerba authored Nov 29, 2022
1 parent eb8f972 commit b50f289
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/material/form-field/_mdc-text-field-structure-overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,15 @@
border: none;
}

// In order to ensure proper alignment of the floating label, we reset its line-height.
// The line-height is not important as the element is absolutely positioned and only has one line
// of text.
.mat-mdc-form-field .mat-mdc-floating-label.mdc-floating-label {
// In order to ensure proper alignment of the floating label, we reset its line-height.
// The line-height is not important as the element is absolutely positioned and only has one
// line of text.
line-height: normal;
// This allows users to focus the input by clicking the part of the label above the outline box,
// and makes migration from the legacy form-field easier for tests that were depending on
// clicking the label to focus the input.
pointer-events: all;
}

// Reset the height that MDC sets on native input elements. We cannot rely on their
Expand Down
2 changes: 1 addition & 1 deletion src/material/input/input.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('input', () => {

it('should increment when increment button clicked', async () => {
const input = element(by.id('number-input'));
await input.click();
await browser.actions().mouseMove(input).click().perform();

const size = await input.getSize();

Expand Down

0 comments on commit b50f289

Please sign in to comment.