Skip to content

Commit

Permalink
DataGrid - fix focusing for groupFooter & footer (#25505)
Browse files Browse the repository at this point in the history
  • Loading branch information
pomahtri authored Sep 5, 2023
1 parent f6a68b9 commit 35aff7b
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 268 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const DATAGRID_GROUP_FOOTER_CLASS = 'dx-datagrid-group-footer';
const DATAGRID_GROUP_TEXT_CONTENT_CLASS = 'dx-datagrid-group-text-content';
const DATAGRID_NOWRAP_CLASS = 'dx-datagrid-nowrap';
const DATAGRID_FOOTER_ROW_CLASS = 'dx-footer-row';
const DATAGRID_CELL_DISABLED = 'dx-cell-focus-disabled';

const DATAGRID_GROUP_FOOTER_ROW_TYPE = 'groupFooter';
const DATAGRID_TOTAL_FOOTER_ROW_TYPE = 'totalFooter';
Expand All @@ -39,17 +40,21 @@ export const renderSummaryCell = function (cell, options) {
if (!column.command && summaryItems) {
for (let i = 0; i < summaryItems.length; i++) {
const summaryItem = summaryItems[i];
const text = gridCore.getSummaryText(summaryItem, options.summaryTexts);

$summaryItems.push($('<div>')
.css('textAlign', summaryItem.alignment || column.alignment)
.addClass(DATAGRID_SUMMARY_ITEM_CLASS)
.addClass(DATAGRID_TEXT_CONTENT_CLASS)
.addClass(summaryItem.cssClass)
.toggleClass(DATAGRID_GROUP_TEXT_CONTENT_CLASS, options.rowType === 'group')
.text(gridCore.getSummaryText(summaryItem, options.summaryTexts)));
.text(text)
.attr('aria-label', `${column.caption} ${text}`));
}
$cell.append($summaryItems);
}
};

const getSummaryCellOptions = function (that, options) {
const summaryTexts = that.option('summary.texts') || {};

Expand Down Expand Up @@ -148,6 +153,8 @@ export const FooterView = ColumnsView.inherit((function () {

if (row.rowType === DATAGRID_TOTAL_FOOTER_ROW_TYPE) {
$row.addClass(DATAGRID_FOOTER_ROW_CLASS);
$row.addClass(DATAGRID_CELL_DISABLED);
$row.attr('tabindex', 0);
}

return $row;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1802,7 +1802,8 @@ export class KeyboardNavigationController extends modules.ViewController {
return false;
}

if (row && row.rowType === 'group' && cellPosition.columnIndex > 0) {
const isFullRowFocus = row?.rowType === 'group' || row?.rowType === 'groupFooter';
if (isFullRowFocus && cellPosition.columnIndex > 0) {
return true;
}

Expand Down

This file was deleted.

12 changes: 12 additions & 0 deletions packages/devextreme/scss/widgets/base/dataGrid/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -331,3 +331,15 @@ $datagrid-text-stub-background-image-path: null !default;
background-color: color.change($datagrid-base-color, $alpha: 0.08);
}
}

.dx-datagrid-total-footer {
tr {
outline: none;
}

&:focus-within {
outline: 2px solid $datagrid-focused-border-color;
outline-offset: -2px;
}
}

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 35aff7b

Please sign in to comment.