-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"wormholing" elements destroys focus, selection #22
Comments
adamesque
added a commit
to adamesque/ember-wormhole
that referenced
this issue
Jul 16, 2015
Merged
can you add a test for this? |
Oh weird — I did! It's in the PR, right? |
Sorry, I assumed it was squashed, it is the PR, I was just looking at the one commit by mistake. |
No worries — I can squash too if that's what you prefer. Thanks for taking a look! |
xcambar
pushed a commit
to xcambar/ember-wormhole
that referenced
this issue
Nov 4, 2016
README: Fix code samples
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If an element to be sent through an ember-wormhole currently has (or is the parent of an element that has) focus, the process of reparenting the element during
appendRange
destroys focus and shiftsdocument.activeElement
back to the<body>
.I'm running into this when using ember-cli-focus-input inside an ember-modal-dialog — the
{{focus-input}}
component'sdidInsertElement
handler fires first, focuses & selects the input element, but if the dialog is also opening at the same time, the wormhole'sdidInsertElement
fires last, reparenting the DOM nodes and wiping out the focus.It might be reasonable to check
document.activeElement
at the beginning ofappendToDestination
and hang on the element if it's part of the wormhole's content so focus could be restored on the other side ofappendRange
.I'm not sure how much extra work you'd need to do to preserve selection ranges as well; I mostly care about the selection inside the text input, which might be easier to handle than generic selection.
The text was updated successfully, but these errors were encountered: