fix: tooltips for form fields not showing

This commit is contained in:
Björn Fromme
2025-11-11 15:12:28 +01:00
parent e7cf172b9f
commit 84ed41f325
2 changed files with 13 additions and 5 deletions
+3
View File
@@ -16,14 +16,17 @@ export default class extends Controller {
trigger: 'click',
allowHTML: true,
interactive: true,
appendTo: document.body,
}
} else {
options = {
content: this.contentValue,
placement,
touch: false,
trigger: 'mouseenter focus',
allowHTML: true,
interactive: true,
appendTo: document.body,
}
}
if (this.hasTriggerTarget) {
+9 -4
View File
@@ -95,7 +95,7 @@
{%- set tooltip = attr.tooltip -%}
{%- set attr = attr|filter((v, k) => k != 'tooltip') -%}
{%- endif -%}
<div{% if tooltip is not null %} {{ stimulus_controller('tooltip', { 'content': tooltip }) }}{% endif %}>
<div{% if tooltip is not null %} {{ stimulus_controller('tooltip', { 'content': tooltip }) }} tabindex="0"{% endif %}>
<input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
</div>
{%- endblock radio_widget -%}
@@ -105,8 +105,8 @@
{%- if form.vars.attr.tooltip is defined -%}
{%- set tooltip = form.vars.attr.tooltip -%}
{%- endif -%}
<div>
<label for="{{ form.vars.id }}" class="{{ html_classes('relative flex items-start', { 'cursor-not-allowed pointer-events-none': form.vars.attr.readonly is defined }) }}"{% if tooltip is not null %} {{ stimulus_controller('tooltip', { 'content': tooltip }) }}{% endif %}>
<div{% if tooltip is not null %} {{ stimulus_controller('tooltip', { 'content': tooltip }) }} tabindex="0"{% endif %}>
<label for="{{ form.vars.id }}" class="{{ html_classes('relative flex items-start', { 'cursor-not-allowed pointer-events-none': form.vars.attr.readonly is defined }) }}">
<div class="flex h-6 items-center">
{{ form_widget(form) }}
</div>
@@ -126,8 +126,13 @@
{%- if disabled is defined and disabled == true -%}
{%- set attr = attr|merge({'class': attr.class|default('') ~ ' cursor-not-allowed' }) -%}
{%- endif -%}
{%- set tooltip = null -%}
{%- if attr.tooltip is defined -%}
{%- set tooltip = attr.tooltip -%}
{%- set attr = attr|filter((v, k) => k != 'tooltip') -%}
{%- endif -%}
{%- if attr.readonly is defined %}
<div class="cursor-not-allowed">
<div class="cursor-not-allowed"{% if tooltip is not null %} {{ stimulus_controller('tooltip', { 'content': tooltip }) }} tabindex="0"{% endif %}>
{{ parent() }}
</div>
{% else %}