Permalink
Show file tree
Hide file tree
2 comments
on commit
sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Autocomplete: Insert the live region before the input. Fixes #9172 - …
…Autocomplete: .replaceWith() fails to replace.
- Loading branch information
1 parent
f281ce9
commit ff11b69a67e0176c851ff3bdec997c7a75d47a42
Showing
2 changed files
with
11 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ff11b69
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.
Why is this works? What is a reason that jQuery#replaceWith is sensitive on position of widget element (before vs after) ?
ff11b69
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.
When
.replaceWith()
runs, it removes the input element. When that element is removed, the autocomplete widget automatically destroys itself. When the autocomplete widget is destroyed, the live region is removed. When.replaceWith()
does the insertion, it needs to have a reference to an element to insert relative to (it could be the next sibling, the previous sibling, or the parent if there are no siblings). We just have to use the position that happens to work with the current implementation. It's unlikely that the position used by.replaceWith()
will change in the future.