There's one remaining issue: the DOM is changing between mouse press and mouse release, which is confusing the select handler.
Options:
There's some precedent for the latter option even if it might get confusing in the presence of drag operations. But that seems confusing either way. Just be consistent.
CCMG4VMKBKBL5ZCUBAVJWCBOGRHS34VB2OH2A24PHALBITX3TNBAC in_rect = function(rect, x,y)-- return true if x,y in viewport coordinates lie with rect on the surfaceif x < vx(rect.x) then return endif y < vy(rect.y) then return endif x > vx(rect.x+rect.w) then return endif y > vy(rect.y+rect.h) then return endreturn trueend
-- other buttons need manual handlingif Global_state.thread == nil then-- we're rendering the file picker-- compute_layout reuses nodes and so it fills in x,y for usfor _,button in ipairs(Global_state.file_picker) doif in_rect(button, x,y) thenopen_thread(button.data[1].data)A()breakendendend