Roller jumps to top when pressed (scrolling works)

Description

When using a roller object, it jumps to the top of the roller options when clicked. The roller works as expected when dragging, and works correctly using the PC simulator.

What MCU/Processor/Board and compiler are you using?

Texas Instruments CC3220, custom board
LCD with capacitive touch, interrupt driven driver (interrupt on press, polled until released).

What do you experience?

See the attached video for a demonstration - scrolling works well, but clicking on a visible roller option causes the roller to scroll to the top of the list of options, whether clicking above or below the currently selected option.
This problem is not present on the PC simulator.
I had this problem with LVGL 6.1 and 7.1.

What do you expect?

Clicking on a visible roller option should select that option.

Code to reproduce

    *roller = lv_roller_create( params->screen, NULL );
    lv_obj_add_style( *roller, LV_ROLLER_PART_BG, &menu->roller_style_bg );
    lv_obj_add_style( *roller, LV_ROLLER_PART_SELECTED, &menu->roller_style_sel );
    lv_roller_set_fix_width( *roller, 300 );
    lv_roller_set_options( *roller, "Pet Care\nInfant\nAutomotive\nBalanced\nSensitive\nComfort\nAsthmatic", LV_ROLLER_MODE_NORMAL );
    lv_roller_set_visible_row_count( *roller, 4 );
    lv_roller_set_anim_time( *roller, 500 );

Screenshot and/or video

ezgif.com-resize

Since you’re using an interrupt driven driver, it might be worth confirming that you are sending the correct pressed/released state to LVGL (e.g. by printing out state changes and checking that they match your finger). That can sometimes be the cause of bugs like this.

Hi, thank you for the suggestion. I found the problem, my touch screen driver was returning coordinates 0,0 when touch was released. I changed to return the last known coordinates as required and now the roller works as expected.

I figured it would be something like that. Glad you solved it! :slightly_smiling_face: