Skip to content

Commit 5e9032e

Browse files
authored
📌 Sticky columns: The focus borders are not displayed correctly for group row, group footer and fields of adaptive row when there are fixed columns (#28389)
1 parent da4b429 commit 5e9032e

File tree

9 files changed

+140
-3
lines changed

9 files changed

+140
-3
lines changed
59 KB
Loading
58.9 KB
Loading
66.6 KB
Loading
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
2+
import DataGrid from 'devextreme-testcafe-models/dataGrid';
3+
import { createWidget } from '../../../helpers/createWidget';
4+
import url from '../../../helpers/getPageUrl';
5+
import { getData } from '../helpers/generateDataSourceData';
6+
7+
const DATA_GRID_SELECTOR = '#container';
8+
9+
fixture.disablePageReloads`FixedColumns - Focus Overlay`
10+
.page(url(__dirname, '../../container.html'));
11+
12+
test('Focus overlay should be displayed correctly if sticky columns are turned on', async (t) => {
13+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
14+
15+
const dataGrid = new DataGrid(DATA_GRID_SELECTOR);
16+
17+
await t.expect(dataGrid.isReady()).ok();
18+
19+
await t
20+
.click(dataGrid.getGroupRow(0).element)
21+
.pressKey('tab');
22+
23+
await takeScreenshot('datagrid_group_row_focused.png', dataGrid.element);
24+
25+
await t
26+
.click(dataGrid.getDataRow(2).getCommandCell(40).getAdaptiveButton())
27+
.pressKey('tab');
28+
29+
await takeScreenshot('datagrid_adaptive_item_focused.png', dataGrid.element);
30+
31+
await t
32+
.click(dataGrid.getGroupFooterRow().nth(0))
33+
.pressKey('tab');
34+
35+
await takeScreenshot('datagrid_group_footer_row_focused.png', dataGrid.element);
36+
37+
await t
38+
.expect(compareResults.isValid())
39+
.ok(compareResults.errorMessages());
40+
}).before(async () => createWidget('dxDataGrid', {
41+
dataSource: getData(20, 40),
42+
columnFixing: {
43+
enabled: true,
44+
},
45+
groupPanel: {
46+
visible: true,
47+
},
48+
width: 800,
49+
showColumnHeaders: true,
50+
columnAutoWidth: true,
51+
allowColumnReordering: true,
52+
allowColumnResizing: true,
53+
summary: {
54+
totalItems: [{
55+
column: 'field_1',
56+
summaryType: 'count',
57+
}, {
58+
column: 'field_6',
59+
summaryType: 'count',
60+
}],
61+
groupItems: [{
62+
column: 'field_0',
63+
summaryType: 'count',
64+
showInGroupFooter: false,
65+
alignByColumn: true,
66+
},
67+
{
68+
column: 'field_11',
69+
summaryType: 'count',
70+
showInGroupFooter: false,
71+
alignByColumn: true,
72+
}, {
73+
column: 'field_6',
74+
summaryType: 'count',
75+
showInGroupFooter: true,
76+
}],
77+
},
78+
customizeColumns(columns) {
79+
columns[5].fixed = true;
80+
columns[6].fixed = true;
81+
82+
columns[11].fixed = true;
83+
columns[11].fixedPosition = 'right';
84+
columns[12].fixed = true;
85+
columns[12].fixedPosition = 'right';
86+
87+
columns.splice(15, 5, {
88+
caption: 'Band column 1',
89+
columns: [{
90+
caption: 'Nested column 1',
91+
columns: ['field_15', 'field_16'],
92+
},
93+
'field_17',
94+
{
95+
caption: 'Nested column 2',
96+
columns: ['field_18', 'field_19'],
97+
}],
98+
});
99+
100+
columns.splice(25, 4, {
101+
caption: 'Band column 2',
102+
columns: [
103+
'field_29',
104+
{
105+
caption: 'Nested column 3',
106+
columns: ['field_30', 'field_31'],
107+
},
108+
'field_32',
109+
],
110+
});
111+
112+
columns[0].hidingPriority = 0;
113+
columns[columns.length - 1].hidingPriority = 1;
114+
columns[columns.length - 2].hidingPriority = 2;
115+
columns[columns.length - 3].hidingPriority = 3;
116+
117+
columns[1].groupIndex = 0;
118+
columns[2].groupIndex = 1;
119+
},
120+
}));

‎packages/devextreme-scss/scss/widgets/base/_gridBase.scss‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,7 @@
10801080
border-collapse: separate;
10811081
}
10821082

1083-
.dx-focused-fixed-cell {
1083+
.dx-focused-fixed-element {
10841084
z-index: 3;
10851085
}
10861086

‎packages/devextreme/js/__internal/grids/grid_core/keyboard_navigation/const.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const EDITOR_CELL_CLASS = 'dx-editor-cell';
1919
export const DROPDOWN_EDITOR_OVERLAY_CLASS = 'dx-dropdowneditor-overlay';
2020
export const COMMAND_EXPAND_CLASS = 'dx-command-expand';
2121
export const ADAPTIVE_COLUMN_NAME_CLASS = 'dx-command-adaptive';
22+
export const ADAPTIVE_ITEM_TEXT_CLASS = 'dx-adaptive-item-text';
2223
export const COMMAND_SELECT_CLASS = 'dx-command-select';
2324
export const COMMAND_EDIT_CLASS = 'dx-command-edit';
2425
export const COMMAND_CELL_SELECTOR = '[class^=dx-command]';

‎packages/devextreme/js/__internal/grids/grid_core/keyboard_navigation/m_keyboard_navigation_utils.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { isDefined } from '@js/core/utils/type';
33

44
import { EDITOR_CELL_CLASS } from '../editing/const';
55
import {
6+
ADAPTIVE_ITEM_TEXT_CLASS,
67
COMMAND_SELECT_CLASS, DATA_ROW_CLASS, EDIT_FORM_CLASS, FREESPACE_ROW_CLASS, GROUP_ROW_CLASS, HEADER_ROW_CLASS,
78
MASTER_DETAIL_ROW_CLASS, VIRTUAL_ROW_CLASS,
89
} from './const';
@@ -19,6 +20,10 @@ export function isGroupFooterRow($row) {
1920
export function isDetailRow($row) {
2021
return $row && $row.hasClass(MASTER_DETAIL_ROW_CLASS);
2122
}
23+
export function isAdaptiveItem($element) {
24+
return $element && $element.hasClass(ADAPTIVE_ITEM_TEXT_CLASS);
25+
}
26+
2227
export function isEditForm($row) {
2328
return $row && $row.hasClass(MASTER_DETAIL_ROW_CLASS) && $row.hasClass(EDIT_FORM_CLASS);
2429
}

‎packages/devextreme/js/__internal/grids/grid_core/sticky_columns/const.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const CLASSES = {
1616
firstHeader: 'first-header',
1717
columnNoBorder: 'column-no-border',
1818
groupRowContainer: 'group-row-container',
19-
focusedFixedCell: 'dx-focused-fixed-cell',
19+
focusedFixedElement: 'dx-focused-fixed-element',
2020
focused: 'dx-focused',
2121
hidden: 'dx-hidden',
2222
};

‎packages/devextreme/js/__internal/grids/grid_core/sticky_columns/m_sticky_columns.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import type {
1313
ColumnsResizerViewController,
1414
DraggingHeaderViewController,
1515
} from '../columns_resizing_reordering/m_columns_resizing_reordering';
16+
import {
17+
isAdaptiveItem,
18+
isGroupFooterRow,
19+
isGroupRow as isGroupRowElement,
20+
} from '../keyboard_navigation/m_keyboard_navigation_utils';
1621
import type { ModuleType } from '../m_types';
1722
import gridCoreUtils from '../m_utils';
1823
import { CLASSES as MASTER_DETAIL_CLASSES } from '../master_detail/const';
@@ -768,8 +773,14 @@ const editorFactory = (Base: ModuleType<EditorFactory>) => class EditorFactorySt
768773
if (!isHideBorder) {
769774
const isFixedCell = GridCoreStickyColumnsDom
770775
.isFixedCell($element, this.addWidgetPrefix.bind(this));
776+
this._$focusOverlay.toggleClass(CLASSES.focusedFixedElement, isFixedCell);
777+
const isGroupElement = isGroupRowElement($element);
778+
const isGroupFooterRowElement = isGroupFooterRow($element);
779+
const isAdaptiveElement = isAdaptiveItem($element);
771780

772-
this._$focusOverlay.toggleClass(CLASSES.focusedFixedCell, isFixedCell);
781+
if (isFixedCell || isGroupElement || isGroupFooterRowElement || isAdaptiveElement) {
782+
this._$focusOverlay.toggleClass(CLASSES.focusedFixedElement, true);
783+
}
773784
}
774785

775786
super.updateFocusOverlay($element, isHideBorder);

0 commit comments

Comments
 (0)