Skip to content

Commit 9a59ffb

Browse files
committed
fix(grid summaries): summaries overlap pinned summaries
When using css variables, the summary items background doesn't 'inherit' from the parent element. Allow specifying a fallback in the `--var` function. Closes #5361
1 parent 27be555 commit 9a59ffb

File tree

4 files changed

+28
-5
lines changed

4 files changed

+28
-5
lines changed

projects/igniteui-angular/src/lib/core/styles/base/utilities/_functions.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,12 @@
341341
/// // }
342342
/// // otherwise, it will return the value for key 'icon-color' in the '$avatar-theme';
343343
/// @returns {String} - The value of the key in the passed map, or the name of key concatenated with the key name.
344-
@function --var($map, $key) {
344+
@function --var($map, $key, $fallback: '') {
345345
$igx-legacy-support: if(global-variable-exists('igx-legacy-support'), $igx-legacy-support, true);
346346

347347
@if map-has-key($map, $key) {
348348
@if $igx-legacy-support == false {
349-
@return unquote('var(--#{map-get($map, 'name')}-#{$key})');
349+
@return unquote('var(--#{map-get($map, 'name')}-#{$key}, #{$fallback})');
350350
} @else {
351351
@return map-get($map, $key);
352352
}

projects/igniteui-angular/src/lib/core/styles/components/grid-summary/_grid-summary-theme.scss

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/// @param {Map} $schema [$light-schema] - The schema used as basis for styling the component.
1010
///
1111
/// @param {Color} $background-color [null] - The summaries background color is inherited form igx-grid__tfoot
12+
/// @param {Color} $focus-background-color [null] - The background color when a summary item is on focus.
1213
/// @param {Color} $label-color [null] - The summaries label color.
1314
/// @param {Color} $result-color [null] - The summaries value/result color.
1415
/// @param {Color} $border-color [null] - The summaries border color.
@@ -35,6 +36,7 @@
3536
$schema: $light-schema,
3637
3738
$background-color: null,
39+
$focus-background-color: null,
3840
$label-color: null,
3941
$result-color: null,
4042
$border-color: null,
@@ -62,6 +64,7 @@
6264
name: $name,
6365
palette: $palette,
6466
background-color: $background-color,
67+
focus-background-color: $focus-background-color,
6568
label-color: $label-color,
6669
result-color: $result-color,
6770
border-color: $border-color,
@@ -98,12 +101,27 @@
98101
);
99102

100103
%igx-grid-summary {
104+
position: relative;
101105
display: flex;
102106
flex-direction: column;
103107
flex: 1 1 0%;
104108
padding: map-get($summary-padding, 'comfortable');
105-
background: --var($theme, 'background-color');
109+
background: --var($theme, 'background-color', inherit);
106110
overflow: hidden;
111+
outline-style: none;
112+
113+
&::after {
114+
position: absolute;
115+
content: '';
116+
top: 0;
117+
bottom: 0;
118+
left: 0;
119+
right: 0;
120+
}
121+
122+
&:focus::after {
123+
background: --var($theme, 'focus-background-color');
124+
}
107125
}
108126

109127
%igx-grid-summary--cosy {

projects/igniteui-angular/src/lib/core/styles/themes/schemas/light/_grid-summary.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
/// Generates a light grid-summary schema.
1010
/// @type {Map}
1111
///
12-
/// @property {Color} background-color [inherit] - The summaries background color is inherited form igx-grid__tfoot
12+
/// @property {Color} background-color [inherit] - The summaries background color is inherited form igx-grid__tfoot.
13+
/// @property {Color} focus-background-color [igx-color] - The background color when a summary item is on focus.
1314
/// @property {map} label-color [igx-color: ('primary', 500)] - The summaries label color.
1415
/// @property {Color} result-color [currentColor] - The summaries value/result color.
1516
/// @property {map} border-color [igx-color: ('grays', 400)] - The summaries border color.
@@ -22,6 +23,10 @@
2223

2324
$_light-grid-summary: extend((
2425
background-color: inherit,
26+
focus-background-color: (
27+
igx-color: ('grays', 100)
28+
),
29+
2530
label-color: (
2631
igx-color: ('primary', 500)
2732
),

src/styles/igniteui-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
color: $igx-foreground-color;
1818

1919
@include scrollbar-love();
20-
@include igx-theme($default-palette, $legacy-support: false);
20+
@include igx-theme($default-palette);
2121

2222
.nav-header {
2323
@include nav-logo('../assets/images/rsrcs/igniteui-logo-light-bg', $igx-background-color);

0 commit comments

Comments
 (0)