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 surface
if x < vx(rect.x) then return end
if y < vy(rect.y) then return end
if x > vx(rect.x+rect.w) then return end
if y > vy(rect.y+rect.h) then return end
return true
end
-- other buttons need manual handling
if Global_state.thread == nil then
-- we're rendering the file picker
-- compute_layout reuses nodes and so it fills in x,y for us
for _,button in ipairs(Global_state.file_picker) do
if in_rect(button, x,y) then
open_thread(button.data[1].data)
A()
break
end
end
end