Repository navigation
fix: ignore programmatic clicks when disabled - #5392
Conversation
|
Kudos, SonarCloud Quality Gate passed!
|
|
@vursen I created the ticket and linked it. |
There was a problem hiding this comment.
I'd argue against throwing exceptions and suggest just ignoring such clicks. This would align with the native browser behavior, which ignores programmatic clicks on disabled buttons without throwing exceptions:
<button disabled>Click!</button>
<script>
const button = document.querySelector('button');
button.addEventListener('click', () => {
console.log('click');
});
button.click();
</script>|
@TatuLund, is it Ok if we adjust the PR to avoid throwing an exception? |
|
@yuriy-fix basically yes, but what is your idea for change? |
|
Following #5392 (review) comment, ignore programmatic clicks on disabled buttons without throwing exceptions. |
| } | ||
|
|
||
| @Test | ||
| public void disableOnClick_clickRevertsDisabled_componentIsEnabled() { |
There was a problem hiding this comment.
note: The previous version of the test clicked the already disabled button, which understandably stopped working after the PR change.
|
Kudos, SonarCloud Quality Gate passed!
|
| fireEvent(new ClickEvent<>(this, false, 0, 0, 0, 0, 0, 0, false, | ||
| false, false, false)); |
There was a problem hiding this comment.
I guess it's still possible to get click triggered by manually firing this click event. Not sure if it's a big issue.
Co-authored-by: Sergey Vinogradov <mr.vursen@gmail.com>
Co-authored-by: Sergey Vinogradov <mr.vursen@gmail.com>
|
This ticket/PR has been released with Vaadin 24.3.0.alpha5 and is also targeting the upcoming stable 24.3.0 version. |








fixes #5414