Skip to content

Commit

Permalink
fix: selecting an item swaps its inherited hx-target
Browse files Browse the repository at this point in the history
add explicit hx-target on item
  • Loading branch information
AlexCLeduc authored and lucbelliveau committed Aug 4, 2023
1 parent 3f3c22d commit c018677
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions autocomplete/templates/autocomplete/item.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
hx-include="#{{ component_id }}"
hx-vals='{"name": "{{ name|escapejs }}", "component_id": "{{ component_id|escapejs }}", "item": "{{ item.value|escapejs }}"}'
hx-swap="outerHTML"
{% if swap_oob %}
hx-swap-oob="outerHTML:#{{ component_id }}__item__{{ item.value|make_id }}"
{% endif %}
{% if swap_oob %} hx-swap-oob="outerHTML:#{{ component_id }}__item__{{ item.value|make_id }}" {% else %} hx-target="this" {% endif %}
>
{{ item.label|search_highlight:search }}
</a>
Expand Down Expand Up @@ -74,4 +72,4 @@
phac_aspc_autocomplete_trigger_change(document.currentScript.dataset.componentid + '__container');
</script>

{% endif %}
{% endif %}

0 comments on commit c018677

Please sign in to comment.