Skip to content

fix(form-field): inaccessible in high contrast mode #11736

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

Merged
merged 1 commit into from
Jun 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/lib/form-field/form-field-fill.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@import '../core/style/variables';
@import '../core/style/vendor-prefixes';

@import '../../cdk/a11y/a11y';

// Styles that only apply to the fill appearance of the form-field.

Expand All @@ -27,6 +27,10 @@ $mat-form-field-fill-subscript-padding:
border-radius: $mat-form-field-fill-border-radius $mat-form-field-fill-border-radius 0 0;
padding: $mat-form-field-fill-line-spacing $mat-form-field-fill-side-padding 0
$mat-form-field-fill-side-padding;

@include cdk-high-contrast {
outline: solid 1px;
}
}

.mat-form-field-underline::before {
Expand All @@ -41,6 +45,11 @@ $mat-form-field-fill-subscript-padding:
.mat-form-field-ripple {
bottom: 0;
height: $mat-form-field-fill-underline-ripple-height;

@include cdk-high-contrast {
height: 0;
border-top: solid $mat-form-field-fill-underline-ripple-height;
}
}

// Note that we need this specific of a selector because we don't want
Expand Down
14 changes: 13 additions & 1 deletion src/lib/form-field/form-field-legacy.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import '../core/style/variables';
@import '../core/style/vendor-prefixes';
@import '../../cdk/a11y/a11y';


// Styles that only apply to the legacy appearance of the form-field.
Expand Down Expand Up @@ -36,11 +37,22 @@ $mat-form-field-legacy-underline-height: 1px !default;
// The ripple is the blue animation coming on top of it.
.mat-form-field-underline {
height: $mat-form-field-legacy-underline-height;

@include cdk-high-contrast {
height: 0;
border-top: solid $mat-form-field-legacy-underline-height;
}
}

.mat-form-field-ripple {
$height: $mat-form-field-legacy-underline-height * 2;
top: 0;
height: $mat-form-field-legacy-underline-height * 2;
height: $height;

@include cdk-high-contrast {
height: 0;
border-top: solid $height;
}
}

&.mat-form-field-disabled .mat-form-field-underline {
Expand Down
14 changes: 13 additions & 1 deletion src/lib/form-field/form-field-standard.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import '../core/style/variables';
@import '../core/style/vendor-prefixes';
@import '../../cdk/a11y/a11y';


// Styles that only apply to the standard appearance of the form-field.
Expand All @@ -20,11 +21,22 @@ $mat-form-field-standard-padding-top: 0.75em !default;
// The ripple is the blue animation coming on top of it.
.mat-form-field-underline {
height: $mat-form-field-standard-underline-height;

@include cdk-high-contrast {
height: 0;
border-top: solid $mat-form-field-standard-underline-height;
}
}

.mat-form-field-ripple {
$height: $mat-form-field-standard-underline-height * 2;
bottom: 0;
height: $mat-form-field-standard-underline-height * 2;
height: $height;

@include cdk-high-contrast {
height: 0;
border-top: $height;
}
}

&.mat-form-field-disabled .mat-form-field-underline {
Expand Down
9 changes: 9 additions & 0 deletions src/lib/form-field/form-field.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import '../core/style/variables';
@import '../core/style/vendor-prefixes';
@import '../../cdk/a11y/a11y';


// Styles that apply to all appearances of the form-field.
Expand Down Expand Up @@ -52,6 +53,14 @@ $mat-form-field-default-infix-width: 180px !default;
flex: auto;
min-width: 0;
width: $mat-form-field-default-infix-width;

// In high contrast mode IE/Edge will render all of the borders, even if they're transparent.
// Since we can't remove the border altogether or replace it with a margin, because it'll throw
// off the baseline, and we can't use a base64-encoded 1x1 transparent image because of CSP,
// we work around it by setting a linear gradient that goes from `transparent` to `transparent`.
@include cdk-high-contrast {
border-image: linear-gradient(transparent, transparent);
}
}

// Used to hide the label overflow on IE, since IE doesn't take transform into account when
Expand Down