Skip to content

Commit d5a782a

Browse files
fix(masked-input): Value not committed on auto-fill behavior (#1932)
* fix(masked-input): Value not commited on auto-fill behavior * chore: Added storybook sample reproducing the issue * refactor(input): autofill styles * remove(datepicker): Autofill story --------- Co-authored-by: Simeon Simeonoff <[email protected]> (cherry picked from commit 48a8180)
1 parent 2053d3f commit d5a782a

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

src/components/date-picker/date-picker.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,6 @@ describe('Date picker', () => {
969969

970970
it('issue 1884 - should emit igcChange event in dialog mode after clearing the value and losing focus', async () => {
971971
const eventSpy = spy(picker, 'emitEvent');
972-
// const nativeInput = dateTimeInput.renderRoot.querySelector('input')!;
973972

974973
// Dropdown mode
975974

src/components/input/themes/input.base.scss

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,8 @@
3434
// This is a hack that removes the autofill background and it's essential,
3535
// otherwise the background is on top of the floating label in material theme.
3636
// The !important flag is because themes that defin transition delay on that element are overriding the transition delay hack
37-
&:-webkit-autofill,
38-
&:-webkit-autofill:hover,
39-
&:-webkit-autofill:focus,
40-
&:-webkit-autofill:active,
41-
&:autofill,
42-
&:autofill:hover,
43-
&:autofill:focus,
44-
&:autofill:active{
37+
&:is(:-webkit-autofill, :autofill) {
38+
transition-property: background-color, color !important;
4539
transition-delay: 99999s !important;
4640
}
4741
}

src/components/mask-input/mask-input-base.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ export abstract class IgcMaskInputBaseComponent extends IgcInputBaseComponent {
116116
value.substring(this._inputSelection.start, this._inputSelection.end),
117117
{ ...this._inputSelection }
118118
);
119+
120+
// Potential browser auto-fill behavior
121+
case undefined:
122+
return this._updateInput(
123+
value.substring(start, this._inputSelection.end),
124+
{
125+
start,
126+
end: this._inputSelection.end,
127+
}
128+
);
119129
}
120130
}
121131

0 commit comments

Comments
 (0)