Skip to content

Commit

Permalink
Fixes liferay#1242 - (ClayCSS) SVG Icons added `.lexicon-icon-contain…
Browse files Browse the repository at this point in the history
…er` to wrap svg icons so we can have the icon name spoken for screen readers at the bare minimum
  • Loading branch information
pat270 committed Nov 13, 2018
1 parent 55cd657 commit dcf1be7
Show file tree
Hide file tree
Showing 22 changed files with 88 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/clay-css/src/scss/components/_badges.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
@include clay-link($badge-close);
}

.lexicon-icon-container,
.lexicon-icon {
height: $badge-lexicon-icon-height;
margin-top: $badge-lexicon-icon-margin-top;
Expand Down
7 changes: 5 additions & 2 deletions packages/clay-css/src/scss/components/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,11 @@
}
}

&.btn .lexicon-icon {
margin-top: 0;
&.btn {
.lexicon-icon-container,
.lexicon-icon {
margin-top: 0;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions packages/clay-css/src/scss/components/_dropdowns.scss
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,8 @@
}

.inline-item .lexicon-icon,
.inline-item .lexicon-icon-container,
.lexicon-icon-container,
.lexicon-icon {
margin-top: 0;
}
Expand Down
20 changes: 15 additions & 5 deletions packages/clay-css/src/scss/components/_icons.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
.lexicon-icon-container {
display: inline-block;
height: $lexicon-icon-size;
margin-top: -3px;
vertical-align: middle;
width: $lexicon-icon-size;

.lexicon-icon {
display: block;
margin-top: 0;
}
}

.lexicon-icon {
display: inline-block;
fill: currentColor;
height: $lexicon-icon-size;
margin-top: -3px;
pointer-events: none;
vertical-align: middle;
width: $lexicon-icon-size;
}
Expand Down Expand Up @@ -43,6 +55,7 @@ a.collapse-icon {
.collapse-icon-open {
.lexicon-icon {
display: block;
margin-top: 0;
}
}

Expand All @@ -52,14 +65,11 @@ a.collapse-icon {
bottom: $collapse-icon-position-bottom;
height: 1em;
left: $collapse-icon-position-left;
line-height: 1;
position: absolute;
right: $collapse-icon-position-right;
top: $collapse-icon-position-top;
width: 1em;

.lexicon-icon {
margin-top: 0;
}
}

.collapse-icon-closed {
Expand Down
1 change: 1 addition & 0 deletions packages/clay-css/src/scss/components/_labels.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ a.label {
@include clay-link($label-close);
}

.lexicon-icon-container,
.lexicon-icon {
height: $label-lexicon-icon-height;
margin-top: $label-lexicon-icon-margin-top;
Expand Down
4 changes: 4 additions & 0 deletions packages/clay-css/src/scss/components/_links.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ button.link-outline {
text-decoration: none;
}

.inline-item .lexicon-icon-container,
.inline-item .lexicon-icon,
.lexicon-icon-container,
.lexicon-icon {
margin-top: 0;
}
Expand Down Expand Up @@ -73,7 +75,9 @@ button.link-outline {
vertical-align: middle;
width: $link-monospaced-size;

.inline-item .lexicon-icon-container,
.inline-item .lexicon-icon,
.lexicon-icon-container,
.lexicon-icon {
margin-top: 0;
}
Expand Down
1 change: 1 addition & 0 deletions packages/clay-css/src/scss/components/_multi-step-nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ a.multi-step-icon {
vertical-align: baseline;
}

.lexicon-icon-container,
.lexicon-icon {
height: $multi-step-icon-font-size;
margin-top: 0;
Expand Down
4 changes: 4 additions & 0 deletions packages/clay-css/src/scss/components/_navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@
padding: $navbar-brand-padding-y $navbar-nav-link-padding-x;
position: relative;

.lexicon-icon-container {
margin-top: 0;
}

.lexicon-icon {
min-width: 1em;
margin-left: 3px;
Expand Down
2 changes: 2 additions & 0 deletions packages/clay-css/src/scss/components/_navs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
margin-right: 0;
}

.lexicon-icon-container,
.lexicon-icon {
margin-top: 0;
}
Expand Down Expand Up @@ -69,6 +70,7 @@
min-width: $nav-item-monospaced-size;
padding: 0;

.lexicon-icon-container,
.lexicon-icon {
margin-top: 0;
}
Expand Down
7 changes: 7 additions & 0 deletions packages/clay-css/src/scss/components/_panels.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@
right: $panel-header-collapse-icon-right;
top: $panel-header-collapse-icon-top;
}

&.collapse-icon-middle {
.collapse-icon-closed,
.collapse-icon-open {
top: 50%;
}
}
}

.panel-header-link {
Expand Down
1 change: 1 addition & 0 deletions packages/clay-css/src/scss/components/_quick-action.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
opacity: $quick-action-item-disabled-opacity;
}

.lexicon-icon-container,
.lexicon-icon {
margin-top: 0;
}
Expand Down
1 change: 1 addition & 0 deletions packages/clay-css/src/scss/components/_stickers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
> .inline-item {
font-size: $sticker-inline-item-font-size;

.lexicon-icon-container,
.lexicon-icon {
margin-top: 0;
}
Expand Down
2 changes: 2 additions & 0 deletions packages/clay-css/src/scss/components/_tbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@
padding: 0;
text-align: center;

.inline-item .lexicon-icon-container,
.inline-item .lexicon-icon,
.lexicon-icon-container,
.lexicon-icon {
margin-top: 0;
}
Expand Down
8 changes: 8 additions & 0 deletions packages/clay-css/src/scss/components/_toggle-switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
.toggle-switch-icon {
font-size: $toggle-switch-bar-font-size;

.lexicon-icon-container {
margin-top: -0.2em;

.lexicon-icon {
margin-top: 0;
}
}

.lexicon-icon {
margin-top: -0.2em;
}
Expand Down
5 changes: 5 additions & 0 deletions packages/clay-css/src/scss/components/_utilities.scss
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,14 @@
display: inline;
}

.lexicon-icon-container,
.lexicon-icon {
margin-top: $inline-item-lexicon-icon-margin-top;
}

.lexicon-icon-container .lexicon-icon {
margin-top: 0;
}
}

.inline-item-before {
Expand Down
1 change: 1 addition & 0 deletions packages/clay-css/src/scss/mixins/_background.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
vertical-align: $indicator-vertical-align;
width: $indicator-width;

.lexicon-icon-container,
.lexicon-icon {
display: none;
}
Expand Down
12 changes: 12 additions & 0 deletions packages/clay-css/src/scss/mixins/_badges.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
padding-right: $padding-x;
padding-top: $padding-y;


// Inline Item in Badges are deprecated in v2.0.0-rc.11 use .badge-item
// pattern instead
.inline-item {
a,
.btn-unstyled,
Expand All @@ -38,4 +41,13 @@
width: $lexicon-icon-width;
}
}

.badge-item {
.lexicon-icon-container,
.lexicon-icon {
height: $lexicon-icon-height;
margin-top: $lexicon-icon-margin-top;
width: $lexicon-icon-width;
}
}
}
2 changes: 2 additions & 0 deletions packages/clay-css/src/scss/mixins/_cards.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
color: $asset-icon-color;
width: $asset-icon-width;

> .lexicon-icon-container,
> .lexicon-icon-container .lexicon-icon,
> .lexicon-icon {
height: 100%;
width: 100%;
Expand Down
11 changes: 11 additions & 0 deletions packages/clay-css/src/scss/mixins/_labels.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
padding-top: $padding-y;
text-transform: $text-transform;

// Inline Item in Labels are deprecated in v2.0.0-rc.11 use .label-item
// pattern instead
.inline-item {
a,
.btn-unstyled,
Expand All @@ -43,6 +45,15 @@
width: $lexicon-icon-width;
}
}

.label-item {
.lexicon-icon-container,
.lexicon-icon {
height: $lexicon-icon-height;
margin-top: $lexicon-icon-margin-top;
width: $lexicon-icon-width;
}
}
}

@mixin clay-label-variant($map) {
Expand Down
1 change: 1 addition & 0 deletions packages/clay-css/src/scss/mixins/_links.scss
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
text-decoration: $disabled-text-decoration;
}

.lexicon-icon-container,
.lexicon-icon {
margin-bottom: $lexicon-icon-margin-bottom;
margin-right: $lexicon-icon-margin-right;
Expand Down
1 change: 1 addition & 0 deletions packages/clay-css/src/scss/mixins/_menubar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
padding-right: $toggler-padding-x-mobile;
padding-top: $toggler-padding-y-mobile;

.lexicon-icon-container,
.lexicon-icon {
margin-top: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/clay-css/src/scss/variables/_icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $collapse-icon-padding-right: 2.28125rem !default; // 45px
$collapse-icon-position-bottom: null !default;
$collapse-icon-position-left: null !default;
$collapse-icon-position-right: 0.9375rem !default; // 15px
$collapse-icon-position-top: clay-collapse-icon-align($nav-link-padding-y, 0.0625rem, $font-size-base) !default;
$collapse-icon-position-top: clay-collapse-icon-align($nav-link-padding-y, 0.0625rem, 1em) !default;

$lexicon-icon-size: 1em !default; // 16px

Expand Down

0 comments on commit dcf1be7

Please sign in to comment.