lo-th / uil

simple javascript ui
http://lo-th.github.io/uil/
MIT License
556 stars 50 forks source link

mousedown event not fired when button used for opening a link #17

Closed takashi-tk closed 3 years ago

takashi-tk commented 3 years ago

With the following code is used :

ui.add('button', { name: 'Test', fontColor: '#D4B87B', h: 30 } )
  .onChange( ( ) => { let w = window.open('', ''); } );

the mousedown event is not triggered after the execution of the callback. It seems to be caused by the change of focus on the new tab. I didn't managed to find a solution to avoid this.

lo-th commented 3 years ago

Hi, yes i will look that all event is call from root and dispatch to proto

lo-th commented 3 years ago

mm window.open work ??

takashi-tk commented 3 years ago

Yes the window.open code work (under Chrome at least). At execution, a new tab is opened and this tab is displayed automatically (standard behavior of browsers - I think it's not possible to change it programmaticaly). At return to the initial page (the one with UIL), the clicked button is still at its "down state" (visually) and the entire page react as a clickable zone (finger cursor). If I click anywhere, the callback of the button is called.

lo-th commented 3 years ago

ok i will see what i can do

lo-th commented 3 years ago

ok so first solution is open in new window and not in tab second is add { link:true } to button definiition ( example in index.html ) that switch mousedown event to click event.

i have to see if click is good for all buttons

takashi-tk commented 3 years ago

It seems to work perfectly. Thank you !