Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve cancellation of events when using
disabled
or `aria-disable…
…d` attributes (#2890) * only cancel certain events when disabled The initial idea was that whenever an element had the `disabled` or `aria-disabled` prop/attribute that we were going to remove all the event listeners. However, this is not ideal because in some scenario's we were actually explicitly adding `onClick()` listeners (for `<a>` elements) to `e.preventDefault()` when the link was marked as "disabled" to prevent it executing the actual link click. This commit will allow all defined listeners as-is, however, if you are using one of the following event listeners: - `onClick` - `onPointerUp` - `onPointerDown` - `onMouseUp` - `onMouseDown` - `onKeyUp` - `onKeyPress` - `onKeyDown` Then we will replace it with `(e) => e.preventDefault()` instead. This way we are still invoking your own listeners, but are explicitly calling `e.preventDefault()` on listeners that should not be executed in the first place when an element is `disabled`. * update CHANGELOG.md * update CHANGELOG.md
- Loading branch information
33a5893
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
headlessui-vue – ./packages/playground-vue
headlessui-vue.vercel.app
headlessui-vue-git-main-tailwindlabs.vercel.app
headlessui-vue-tailwindlabs.vercel.app