handsontable icon indicating copy to clipboard operation
handsontable copied to clipboard

[3.0.0+] Scroll to Top of Window when Selecting Cells

Open wayne-weibel opened this issue 8 years ago • 11 comments

Description

When selecting cells in a different column of the table, the window is scrolled to the top of the page. If selecting other cells in the same column no scrolling occurs.

I have a table that has 3 columns; dropdown, input, input (numeric). Looking at the rendered HTML there are 3 separate handsontableInputHolder (after selecting different column cell, can see each element created/added with first selection of the cell)

I attempted to set preventScrolling in the afterSelection hook, also editing the source directly in several spots that seemed likely - obviously non worked.

Steps to reproduce

  1. create a table with multiple columns and input types
  2. add the table to an element below the fold of the browser window
  3. select a cell in one of the columns (scroll should occur)
  4. select a cell in a different column

Demo

issue is present in tutorial for scrolling ... occurs with first cell selection, but not after since using the same editor (I assume). ie. refresh the page to see the issue again.

https://docs.handsontable.com/4.0.0/demo-scrolling.html

Your environment

  • Handsontable version: 4.0.0
  • Browser Name and version: Firefox 60.0.2
  • Operating System: Linux Mint 18.2

image

      @table = Handsontable(@taxtableEl[0],
          data: data,
          autoInsertRow: true,
          autoWrapCol: false,
          autoWrapRow: false,
          minSpareRows: 2,
          minRows: 10,
          colHeaders: ['State', 'ZIP code', 'Percent'],
          colWidths: [160, 90, 60],
          columns: [
            {
              type: 'dropdown',
              source: @states,
              readOnly: @readOnly,
            },
            {
              validator: @isValidZipCode,
              allowInvalid: true,
              readOnly: @readOnly,
              renderer: @validationRenderer,
            },
            {
              type: 'numeric',
              numericFormat: {pattern: '0.0'},
              allowInvalid: true,
              readOnly: @readOnly,
              renderer: @validationRenderer,
            }
          ],
          contextMenu: true
      )

image

wayne-weibel avatar Jun 28 '18 13:06 wayne-weibel

I was literally just in the API docs and it does this on chrome mobile. I thought to myself how does anyone think of using this if it scrolls to the top every time you interact with it. Was going to post this exact issue 👍

For reference, I was on my phone and it happened on every table and every cell on this page https://docs.handsontable.com/pro/4.0.0/demo-filtering.html

tsteuwer-accesso avatar Jun 29 '18 02:06 tsteuwer-accesso

Thank you for sharing. I have replicated it with Firefox 60 and 61 on Windows 10. Chrome 67 doesn't seem to share this behavior.

AMBudnik avatar Jun 29 '18 08:06 AMBudnik

@AMBudnik it does happen on chrome mobile 67. I just had it happen on another phone.

tsteuwer-accesso avatar Jun 29 '18 11:06 tsteuwer-accesso

Thanks for checking @tsteuwer-accesso

AMBudnik avatar Jun 29 '18 11:06 AMBudnik

This does not occur using handsontable 3.0.0 (I am using a hack to remove the invalid css though re: #4896)

wayne-weibel avatar Jun 29 '18 11:06 wayne-weibel

Thanks @wayne-weibel

You're right. I have just checked the https://docs.handsontable.com/4.0.0/demo-scrolling.html on FF 61 and it works fine.

AMBudnik avatar Jun 29 '18 11:06 AMBudnik

Broken in 5.0.1: http://jsfiddle.net/6kusa17w/ And fixed in 5.0.2-RC: http://jsfiddle.net/jzngr938/

wojciechczerniak avatar Sep 11 '18 12:09 wojciechczerniak

Thank you for reporting the investigation results guys! I am happy that this one got solved. If you'd have any similar issues please let me know.

AMBudnik avatar Sep 12 '18 11:09 AMBudnik

Hi guys, i have got still a scrolling problem when the table gets rotated :\ is there a way how to fix it? Thank you. Here is an example: http://jsfiddle.net/9urg2o13/ (was testing it in firefox)

arfis avatar Sep 14 '18 14:09 arfis

I have managed to fix it by creating a custom editor, but now im getting a problem that the copy paste is not working.. what should i do to make the copy paste functionality working? Im extendint the TextEditor

arfis avatar Sep 16 '18 21:09 arfis

Hi @arfis can you share your code in the JSFiddle? I'll test it

AMBudnik avatar Sep 17 '18 06:09 AMBudnik