Skip to content

Scrolling to selection doesn't work, and broken after reload #142

@kuirtevich

Description

@kuirtevich

Hi. Our team have found two problems with the timepicker, which we thought were our improper usage of it, but finally they appeared to be issues of the script itself. I had to make changes in the script to fix them.

First, when you open a dropdown - it does not scroll to the selected value. First I thought this was just not intended to happen, but after analyzing the code, I saw that there is actually logic for it, but it doesn't work because it uses "ui" instead of "viewport" in _hasScroll() and in activate(). The first is not scrollable, while the second is.

Next, if we did ajax reload of the area containing the widget and the initialization script - this made it broken. The reason was in that "widget.viewport" was not assigned in the initializer - there is logic that skips initialization if the DOM element already exists. Also, for the same reason, events were not bound. In the end I have changed that part to remove and recreate the elements in this case.

You can check the updated version attached for more details. Sorry, I am totally new to GitHub, I think I might have collaborated, but I don't know how, and also not sure if this can be done better. So I'm providing this version just as an example. All changed parts are marked as "CUSTOM FIX".
timepicker_updated.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions