Skip to content

Conversation

@bendemboski
Copy link
Contributor

Preventing default on a mousedown event prevents the focus from changing, so implement that behavior in the click and dblclick DOM helpers

Preventing default on a mousedown event prevents the focus from changing, so implement that behavior in the click and dblclick DOM helpers
@bendemboski
Copy link
Contributor Author

This fixes one of the cases that #1033 broke.

My use case is toolbar buttons that perform content operations on the focused contenteditable. The toolbar buttons might do things like enable bold formatting or insert an image, and when clicking them the selection needs to be preserved, so I call preventDefault() on the mousedown event on those buttons to preserve focus. Since the buttons themselves are un-focusable, before #1033, clicking them would do the right thing for the wrong reason (preserve focus because we weren't blurring the active element when clicking an un-focusable element). After #1033 it started doing the wrong thing, but with this change it will do the right thing for the right reason!

@rwjblue rwjblue added the bug label Oct 6, 2021
@rwjblue rwjblue merged commit 59eeb08 into emberjs:master Oct 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants