Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

startScroll is undefined #16793

Closed
liviuconcioiu opened this issue Apr 5, 2021 · 4 comments
Closed

startScroll is undefined #16793

liviuconcioiu opened this issue Apr 5, 2021 · 4 comments
Assignees
Labels
Bug A problem or regression with an existing feature waiting on upstream Issues blocked by a third-party
Projects
Milestone

Comments

@liviuconcioiu
Copy link
Contributor

liviuconcioiu commented Apr 5, 2021

Describe the bug

If you go to SQL and enter a query on multiple lines, that makes a scroll on the right side and also if the last char of the query is a letter that makes a dropdown so you can select the value, will result in a JavaScript error can't access property "top", startScroll is undefined.

To Reproduce

Steps to reproduce the behavior:

  1. Go to SQL
  2. Copy and paste
SELECT
	column1,
	column2,
	column3,
	column4,
	column5,
	column6,
	column7,
	column8,
	column9,
	column10,
	column11,
	column12,
	column13,
	column14,
	column15,
	column16,
	column17,
	column18,
	column19,
	column20
FROM
(
	SELECT
		column1,
		column2,
		column3,
		column4,
		column5,
		column6,
		column7,
		column8,
		column9,
		column10,
		column11,
		column12,
		column13,
		column14,
		column15,
		column16,
		column17,
		column18,
		column19,
		column20
	FROM
		test
) A
  1. See error

And the same error on Browse tab

  1. Select a table
  2. Click on Create view
  3. Paste the same query into AS field
  4. See error

and

  1. Select a table
  2. Click on Edit inline
  3. Paste the same query
  4. See error

Expected behavior

The JavaScript error shouldn't be there.

Screenshots

error1

Client configuration

  • Browser: Firefox
  • Operating system: Windows

Additional context

{
    "pma_version": "5.2.0-dev",
    "browser_name": "FIREFOX",
    "browser_version": "88.0",
    "user_os": "Win",
    "server_software": "nginx/1.14.2",
    "user_agent_string": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0",
    "locale": "en",
    "configuration_storage": "disabled",
    "php_version": "7.4.14",
    "script_name": "index.php",
    "exception_type": "js",
    "exception": {
        "mode": "stack",
        "name": "TypeError",
        "message": "can't access property \"top\", startScroll is undefined",
        "stack": [
            {
                "func": "Widget/this.onScroll",
                "line": "324",
                "column": "20",
                "context": [
                    "      cm.on(\"focus\", this.onFocus = function() { clearTimeout(closingOnBlur//...",
                    "    }",
                    "",
                    "    cm.on(\"scroll\", this.onScroll = function() {",
                    "      var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().g//...",
                    "      var newTop = top + startScroll.top - curScroll.top;",
                    "      var point = newTop - (parentWindow.pageYOffset || (ownerDocument.docu//...",
                    "      if (!below) point += hints.offsetHeight;",
                    "      if (point <= editor.top || point >= editor.bottom) return completion.//...",
                    "      hints.style.top = newTop + \"px\";",
                    "      hints.style.left = (left + startScroll.left - curScroll.left) + \"px\";"
                ],
                "uri": "js/vendor/codemirror/addon/hint/show-hint.js?v=5.2.0-dev",
                "scriptname": "js/vendor/codemirror/addon/hint/show-hint.js"
            },
            {
                "func": "signal",
                "line": "568",
                "column": "61",
                "context": [
                    "",
                    "  function signal(emitter, type /*, values...*/) {",
                    "    var handlers = getHandlers(emitter, type);",
                    "    if (!handlers.length) { return }",
                    "    var args = Array.prototype.slice.call(arguments, 2);",
                    "    for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }",
                    "  }",
                    "",
                    "  // The DOM events that CodeMirror handles can be overridden by",
                    "  // registering a (non-DOM) handler on the editor for the event name,",
                    "  // and preventDefault-ing the event in that handler."
                ],
                "uri": "js/vendor/codemirror/lib/codemirror.js?v=5.2.0-dev",
                "scriptname": "js/vendor/codemirror/lib/codemirror.js"
            },
            {
                "func": "registerEventHandlers/<",
                "line": "7999",
                "column": "15",
                "context": [
                    "    // area, ensure viewport is updated when scrolling.",
                    "    on(d.scroller, \"scroll\", function () {",
                    "      if (d.scroller.clientHeight) {",
                    "        updateScrollTop(cm, d.scroller.scrollTop);",
                    "        setScrollLeft(cm, d.scroller.scrollLeft, true);",
                    "        signal(cm, \"scroll\", cm);",
                    "      }",
                    "    });",
                    "",
                    "    // Listen to wheel events in order to try and update the viewport on time.",
                    "    on(d.scroller, \"mousewheel\", function (e) { return onScrollWheel(cm, e); });"
                ],
                "uri": "js/vendor/codemirror/lib/codemirror.js?v=5.2.0-dev",
                "scriptname": "js/vendor/codemirror/lib/codemirror.js"
            }
        ],
        "uri": "index.php?route=%2Fserver%2Fsql&lang=en"
    }
}
@shucon
Copy link
Contributor

shucon commented Apr 10, 2021

Thanks for the report, I was able to reproduce this. Will fix it.

Affected branch: master, QA_5_1

@williamdes
Copy link
Member

I did edit the query, trailing , did not work on MariaDB

@williamdes williamdes added the Bug A problem or regression with an existing feature label Apr 12, 2021
@williamdes williamdes added this to Needs triage in issues via automation Apr 12, 2021
@williamdes williamdes moved this from Needs triage to Reproduced in issues Apr 12, 2021
@shucon
Copy link
Contributor

shucon commented Apr 14, 2021

8c67664 is the first affected commit.

@williamdes
Copy link
Member

Last codemirror update: 33ba472
Waiting on a new one for the upstream patch

@williamdes williamdes added this to the 5.1.1 milestone Apr 14, 2021
@williamdes williamdes moved this from Reproduced to Waiting on upstream in issues Apr 14, 2021
@williamdes williamdes self-assigned this Apr 20, 2021
williamdes added a commit that referenced this issue Apr 20, 2021
Signed-off-by: William Desportes <williamdes@wdes.fr>
issues automation moved this from Waiting on upstream to Closed Apr 20, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature waiting on upstream Issues blocked by a third-party
Projects
issues
  
Closed
Development

No branches or pull requests

3 participants