diff --git a/app/client/components/GridView.js b/app/client/components/GridView.js index 96b65029..ec7e906e 100644 --- a/app/client/components/GridView.js +++ b/app/client/components/GridView.js @@ -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); diff --git a/test/nbrowser/DescriptionColumn.ts b/test/nbrowser/DescriptionColumn.ts index 87bef772..6b370f59 100644 --- a/test/nbrowser/DescriptionColumn.ts +++ b/test/nbrowser/DescriptionColumn.ts @@ -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();