Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,60 @@ test('Focus overlay should be displayed correctly if sticky columns are turned o
columns[2].groupIndex = 1;
},
}));

test('Native scrollbar should not be shown when the focus overlay is visible (T1310336)', async (t) => {
// arrange
const dataGrid = new DataGrid(DATA_GRID_SELECTOR);
const firstGroupRow = dataGrid.getGroupRow(0);
const firstDataRow = dataGrid.getDataRow(1);
const secondDataCell = firstDataRow.getDataCell(2);
const hasHorizontalScroll = async () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment: Could we move this into the DataGrid helpers? For example, into domUtils?

const scrollableContainer = dataGrid.getScrollContainer();
const scrollWidth = await scrollableContainer.scrollWidth;
const clientWidth = await scrollableContainer.clientWidth;
return scrollWidth > clientWidth;
};

// assert
await t.expect(dataGrid.isReady()).ok();

// act
await t.drag(secondDataCell.element, -2, 0, { offsetX: 1 });

// assert
await t
.expect(firstDataRow.isFocusedRow)
.ok()
.expect(dataGrid.getFocusOverlay().visible)
.notOk()
.expect(await hasHorizontalScroll())
.notOk();
Comment thread
markallenramirez marked this conversation as resolved.

// act
await t.pressKey('up');

// assert
await t
.expect(firstGroupRow.isFocusedRow)
.ok()
.expect(dataGrid.getFocusOverlay().visible)
.ok()
.expect(await hasHorizontalScroll())
.notOk();
}).before(async () => createWidget('dxDataGrid', {
dataSource: getData(20, 5),
keyExpr: 'field_0',
height: 300,
focusedRowEnabled: true,
customizeColumns(columns) {
columns[0].fixed = true;
columns[1].groupIndex = 0;
},
scrolling: {
useNative: true,
},
editing: {
mode: 'cell',
allowUpdating: true,
},
}));
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import type { ValidatingController } from '@ts/grids/grid_core/validating/m_vali

import type { ColumnsController } from '../columns_controller/m_columns_controller';
import type { EditingController } from '../editing/m_editing';
import { isDataRow } from '../keyboard_navigation/utils';
import type { ViewController } from '../m_modules';
import modules from '../m_modules';
import type { Module, ModuleType } from '../m_types';
Expand Down Expand Up @@ -233,13 +234,14 @@ export class EditorFactory extends ViewControllerWithMixin {
} else if ($element.length) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can’t the isDataRow check be moved into this condition?

// align "right bottom" for Mozilla
const align = browser.mozilla ? 'right bottom' : 'left top';
const isDataRowElement = isDataRow($element);
const isFocusedCellInvalid = $element.hasClass(this.addWidgetPrefix(CELL_INVALID_CLASS));
const isFocusedCellModified = $element.hasClass(CELL_MODIFIED_CLASS) && !isFocusedCellInvalid;
const $content = this.getFocusOverlayContainer($element);
const focusOverlaySize = this.getFocusOverlaySize($element);

this._$focusOverlay
.removeClass(DX_HIDDEN)
.toggleClass(DX_HIDDEN, isDataRowElement)
.toggleClass(FOCUSED_CELL_INVALID_CLASS, isFocusedCellInvalid)
Comment thread
markallenramirez marked this conversation as resolved.
.toggleClass(FOCUSED_CELL_MODIFIED_CLASS, isFocusedCellModified)
.appendTo($content);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,10 @@ const editorFactory = (Base: ModuleType<EditorFactory>) => class EditorFactorySt
$element,
this.addWidgetPrefix.bind(this),
);
const isGroupRow = isGroupRowElement($element);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You also need to add a check for the group footer row.

For master/adaptive detail rows, I’ve checked — everything seems fine there. Please make sure to verify this as well.


return {
width: elementRect.right - elementRect.left + (isLastCell || isFixedCell ? 0 : 1),
width: elementRect.right - elementRect.left + (isLastCell || isFixedCell || isGroupRow ? 0 : 1),
height: elementRect.bottom - elementRect.top,
Comment thread
markallenramirez marked this conversation as resolved.
};
}
Expand Down
Loading