Skip to content

Commit b50f289

Browse files
authored
fix(material/form-field): allow clicking on floating label (#26110)
* fix(material/form-field): allow clicking on floating label * fixup! fix(material/form-field): allow clicking on floating label
1 parent eb8f972 commit b50f289

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/material/form-field/_mdc-text-field-structure-overrides.scss

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@
2020
border: none;
2121
}
2222

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

3034
// Reset the height that MDC sets on native input elements. We cannot rely on their

src/material/input/input.e2e.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('input', () => {
2020

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

2525
const size = await input.getSize();
2626

0 commit comments

Comments
 (0)