Flexible Target Selector Configuration for Modal Injection #41
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


Previously, the modal was always inserted at the beforeend position of the target element. This is too restrictive, as some elements don't allow children, modals sometimes need to be inserted before or after elements, and many different DOM structures need to function correctly.
This change allows using the beforebegin, afterbegin, beforeend, and afterend positions and ensures that the allowed positions are spelled and validated correctly.
The new feature ensures that
Additionally, the static selector approach required us to either know the exact selector at initialization time, or use shop-specific CSS classes/selectors
To ensure high compatibility with various themes, templates, and plugins, the targetSelectorResolve function was implemented. This allows the selector to be determined dynamically at runtime.
The new feature ensures that
Examples can be found in the focus-trap demo.
#39