Fix accessibility issues: add tooltip for disabled delete button
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
9233f56847
commit
1bb03b52c9
1 changed files with 27 additions and 24 deletions
|
|
@ -85,34 +85,37 @@ defmodule MvWeb.MembershipFeeTypeLive.Index do
|
||||||
</:action>
|
</:action>
|
||||||
|
|
||||||
<:action :let={mft}>
|
<:action :let={mft}>
|
||||||
|
<div
|
||||||
|
:if={get_member_count(mft, @member_counts) > 0}
|
||||||
|
class="tooltip tooltip-left"
|
||||||
|
data-tip={
|
||||||
|
gettext("Cannot delete - %{count} member(s) assigned",
|
||||||
|
count: get_member_count(mft, @member_counts)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
phx-click="delete"
|
||||||
|
phx-value-id={mft.id}
|
||||||
|
data-confirm={gettext("Are you sure?")}
|
||||||
|
class="btn btn-ghost btn-xs text-error opacity-50 cursor-not-allowed"
|
||||||
|
aria-label={
|
||||||
|
gettext("Cannot delete - %{count} member(s) assigned",
|
||||||
|
count: get_member_count(mft, @member_counts)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
disabled={true}
|
||||||
|
>
|
||||||
|
<.icon name="hero-trash" class="size-4" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<button
|
<button
|
||||||
|
:if={get_member_count(mft, @member_counts) == 0}
|
||||||
phx-click="delete"
|
phx-click="delete"
|
||||||
phx-value-id={mft.id}
|
phx-value-id={mft.id}
|
||||||
data-confirm={gettext("Are you sure?")}
|
data-confirm={gettext("Are you sure?")}
|
||||||
class={[
|
class="btn btn-ghost btn-xs text-error"
|
||||||
"btn btn-ghost btn-xs",
|
aria-label={gettext("Delete membership fee type")}
|
||||||
if(get_member_count(mft, @member_counts) > 0,
|
|
||||||
do: "text-error opacity-50 cursor-not-allowed",
|
|
||||||
else: "text-error"
|
|
||||||
)
|
|
||||||
]}
|
|
||||||
aria-label={
|
|
||||||
if get_member_count(mft, @member_counts) > 0,
|
|
||||||
do:
|
|
||||||
gettext("Cannot delete - %{count} member(s) assigned",
|
|
||||||
count: get_member_count(mft, @member_counts)
|
|
||||||
),
|
|
||||||
else: gettext("Delete membership fee type")
|
|
||||||
}
|
|
||||||
title={
|
|
||||||
if get_member_count(mft, @member_counts) > 0,
|
|
||||||
do:
|
|
||||||
gettext("Cannot delete - %{count} member(s) assigned",
|
|
||||||
count: get_member_count(mft, @member_counts)
|
|
||||||
),
|
|
||||||
else: gettext("Delete")
|
|
||||||
}
|
|
||||||
disabled={get_member_count(mft, @member_counts) > 0}
|
|
||||||
>
|
>
|
||||||
<.icon name="hero-trash" class="size-4" />
|
<.icon name="hero-trash" class="size-4" />
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue