ui5-webcomponents icon indicating copy to clipboard operation
ui5-webcomponents copied to clipboard

[VueJs]disabled button are still clickable

Open mehdijouan opened this issue 7 years ago • 4 comments

Describe the bug disabled buttons are still clickable

To reproduce Steps to reproduce the behavior:

  1. Go to CodeSandbox example
  2. use the count button
  3. change state of the button
  4. click again ... the count continues to increase

Expected behavior nothing should happen when button is disabled

Context

  • UI5 Web Components version 0.12.0
  • OS/Platform: mac os
  • Browser (if relevant): chrome

Affected components (if known) ui5-button

mehdijouan avatar Jun 20 '19 15:06 mehdijouan

Hello @mehdijouan,

Try to use the semantic press event we are providing for the button.

I modified your snippet to <ui5-button type="Positive" :disabled="isActive" v-on:press="updateCount">count</ui5-button>

And counter is not more increased.

Regards, Martin

MapTo0 avatar Jun 20 '19 16:06 MapTo0

P.S. looks like the view fires the onclick event no matter if the target is disabled or no.

To be honest, this sounds strange to me as even the native HTML Button does not fire the click event if the button is disabled.

https://jsbin.com/sokuwixoja/edit?html,output

Thanks for reporting! We were just thinking if we need this press event :D

MapTo0 avatar Jun 20 '19 16:06 MapTo0

Press works fine, thanks for the hint! I have also to admit that the onClick behavior is quite strange...

mehdijouan avatar Jun 20 '19 21:06 mehdijouan

@mehdijouan we have removed all obstacles and are going to deprecate the press event in favour of click. With the next release, click should no longer be fired for disabled buttons so feel free to switch to using it as the recommended way.

pskelin avatar Jun 26 '19 10:06 pskelin