(core) Fix scrolling and column title bugs

Summary:
On Firefox and Safari, setting scrollLeft to a max safe integer was
causing it to be treated as 0. It's not clear why - for now, the
scrollWidth is used instead.

Also fixes a bug where the column title popup wouldn't appear for a
new column if tab was previously used to close the same popup for
the last column.

Test Plan: Browser test.

Reviewers: JakubSerafin

Reviewed By: JakubSerafin

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D3911
pull/550/head
George Gevoian 12 months ago
parent 41280a31f2
commit 0b64e408b0

@ -733,7 +733,7 @@ GridView.prototype.renameColumn = function(index) {
};
GridView.prototype.scrollPaneRight = function() {
this.scrollPane.scrollLeft = Number.MAX_SAFE_INTEGER;
this.scrollPane.scrollLeft = this.scrollPane.scrollWidth;
};
GridView.prototype.selectColumn = function(colIndex) {
@ -958,8 +958,13 @@ GridView.prototype.buildDom = function() {
var renameCommands = {
nextField: function() {
editIndex(editIndex() + 1);
self.selectColumn(editIndex.peek());
if (editIndex() === v.viewFields().peekLength - 1) {
// Turn off editing if we're on the last field.
editIndex(-1);
} else {
editIndex(editIndex() + 1);
self.selectColumn(editIndex.peek());
}
},
prevField: function() {
editIndex(editIndex() - 1);

@ -364,6 +364,23 @@ describe('DescriptionColumn', function() {
await revert();
});
it('should reopen editor when adding new column', async () => {
// This partially worked before - there was a bug where if you pressed tab on
// the last column, and then clicked Add Column, the editor wasn't shown, and the
// auto-generated column name was used.
const revert = await gu.begin();
await doubleClickHeader('E');
await gu.sendKeys(Key.TAB);
assert.isFalse(await popupVisible());
await addColumn();
assert.isTrue(await popupVisible());
await gu.sendKeys(Key.ESCAPE);
await gu.waitForServer();
await revert();
});
it('should support basic edition on CardList', async () => {
const mainSession = await gu.session().teamSite.login();
const api = mainSession.createHomeApi();

Loading…
Cancel
Save