Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(field): clean up autofill animation styles #592

Merged
merged 8 commits into from
May 30, 2024
3 changes: 2 additions & 1 deletion src/lib/chip-field/chip-field.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import './chip-field';
import { CHIP_FIELD_CONSTANTS } from './chip-field-constants';
import { IChipComponent } from '../chips';
import { LABEL_CONSTANTS } from '../label/label-constants';
import { timer } from '@tylertech/forge-testing';

describe('Chip Field', () => {
it('should use shadow DOM', async () => {
Expand All @@ -27,7 +28,7 @@ describe('Chip Field', () => {

it('should be accessible with chips', async () => {
const harness = await createFixture({ hasChips: true });

await timer(200); // Wait for the field animation to complete
await expect(harness.chipField).to.be.accessible();
});

Expand Down
2 changes: 2 additions & 0 deletions src/lib/field/_core.layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@
@include typography.style(body2);
@include item-padding(start, outer);
@include item-padding(end, outer);

z-index: 999;
}

//
Expand Down
1 change: 1 addition & 0 deletions src/lib/field/_core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@

position: relative;
display: grid;
isolation: isolate;

grid-area: main;
grid-template-areas: 'start center end popover-icon accessory';
Expand Down
8 changes: 8 additions & 0 deletions src/lib/field/_core.slotted.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
resize: none;
}

@mixin default-slot-floating-in {
position: absolute;
inset-block-start: calc(#{token(height)} * -0.5);

block-size: 100%;
padding-block: #{token(height)};
}

@mixin slotted-inset-label {
max-inline-size: 100%;
overflow: hidden;
Expand Down
6 changes: 5 additions & 1 deletion src/lib/field/field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ $variants: (
// Floating label
//

:host(#{map.get($label-positions, inset)}[float-label]:not(:is([dense], [density=extra-small]))) {
:host(#{map.get($label-positions, inset)}[float-label]:not(#{map.get($densities, extra-small)})) {
.has-label {
.label {
@include core.floating-label;
Expand All @@ -438,6 +438,10 @@ $variants: (

.input {
@include core.float-in-input;

::slotted(:is(input, [data-forge-field-input], [data-forge-multi-input-separator])) {
@include core.default-slot-floating-in;
}
}
}

Expand Down
Loading