Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop links styled as button from being dragged
In user research we have seen users’ attempts at clicking links styled as buttons not registered because they moved the mouse as they were clicking. This instead triggers the browsers drag behaviour. --- One user we were observing yesterday repeatedly encountered this problem and it took several attempts before they got to the next page. I reckon this is a combination of: - having impaired motor skills - being more familiar with a trackpad and touch screen This only happens with links. With `<button>` elements you can move the mouse between depressing and releasing the button and a `click` event is still registered (as long as the cursor remains inside the button). --- Setting the `draggable` attribute to `false` prevents the drag behaviour from being triggered. This makes links styled as buttons behave in the same way as buttons. --- This attribute is supported in all current browsers: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/draggable#Browser_compatibility It would be possible to develop this further with Javascript so a `click` event could be triggered even if the mouse left the region of the link or button before being released. This would be a more comprehensive fix, but would also involve significantly more engineering effort and potential side effects.
- Loading branch information