Skip to content

Conversation

m4m4m4
Copy link
Contributor

@m4m4m4 m4m4m4 commented Apr 12, 2018

Since scrollIfNecessary is called multiple times when enableCellEditOnFocus is true we need to make sure the scrollbarWidth and footerHeight is accounted for to not cause a loop.

fixes #6653

…ectly Since scrollIfNecessary is called multiple times when enableCellEditOnFocus is true we need to make sure the scrollbarWidth and footerHeight is accounted for to not cause a loop. fixes angular-ui#6653

//Since scrollIfNecessary is called multiple times when enableCellEditOnFocus is true we need to make sure the scrollbarWidth and footerHeight is accounted for to not cause a loop.
if (gridCol.colDef.enableCellEditOnFocus === true) {
scrollPixels = scrollPixels - self.footerHeight - self.scrollbarWidth;
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why we wouldn't want to check this every time? Why are we only checking for the footer and scroll bar when enableCellEditOnFocus is true?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The downside that I have found in leaving it on for everything is that it will scroll a bit too much for the grids not using enableCellEditOnFocus. It makes navigating by keys not appear as smooth and that might make it confusing.

Copy link
Member

@mportuga mportuga Apr 13, 2018

Choose a reason for hiding this comment

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

Hmm, I see, makes sense. Also, as a follow up, could you add a null or undefined check for gridCol instead of assuming it will be there. I ask, because i noticed that a few lines now, we are checking for that and I don't want this to ever blow up on users of this function. I believe refactoring it to the following should work:

if (gridCol && gridCol.colDef && gridCol.colDef.enableCellEditOnFocus) {

There should be no need to explicitly compare enableCellEditOnFocus to true either.

After that, I will merge it and I will see if I release a new version at some point this coming week. I usually try to accumulate at leas 5 bug fixes before doing a new release.

Make sure gridCol is not null before checking for enableCellEditOnFocus
@mportuga mportuga merged commit aef0546 into angular-ui:master Apr 16, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants