Skip to content

Commit 4e02850

Browse files
AtmoFXAtmoFXrobsontenorio
authored
Input: add password-icon-tabindex (#958)
* Added no-tab-stop property to password fields (affects visibility toggle) * WIP --------- Co-authored-by: AtmoFX <[email protected]> Co-authored-by: Robson Tenório <[email protected]>
1 parent 5abce0f commit 4e02850

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/View/Components/Password.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public function __construct(
2626
// Password
2727
public ?string $passwordIcon = 'o-eye-slash',
2828
public ?string $passwordVisibleIcon = 'o-eye',
29+
public ?bool $passwordIconTabindex = false,
2930
public ?bool $right = false,
3031
public ?bool $onlyPassword = false,
3132

@@ -127,7 +128,11 @@ public function render(): View|Closure|string
127128
@if($icon)
128129
<x-mary-icon :name="$icon" class="pointer-events-none w-4 h-4 opacity-40" />
129130
@elseif($placeToggleLeft())
130-
<x-mary-button x-on:click="hidden = !hidden" class="btn-ghost btn-xs btn-circle -m-1">
131+
<x-mary-button
132+
x-on:click="hidden = !hidden"
133+
class="btn-ghost btn-xs btn-circle -m-1"
134+
:tabindex="$passwordIconTabindex ? null : -1"
135+
>
131136
<x-mary-icon name="{{ $passwordIcon }}" x-show="hidden" class="w-4 h-4 opacity-40" />
132137
<x-mary-icon name="{{ $passwordVisibleIcon }}" x-show="!hidden" x-cloak class="w-4 h-4 opacity-40" />
133138
</x-mary-button>
@@ -155,7 +160,11 @@ public function render(): View|Closure|string
155160
@if($iconRight)
156161
<x-mary-icon :name="$iconRight" @class(["pointer-events-none w-4 h-4 opacity-40", "!end-10" => $clearable]) />
157162
@elseif($placeToggleRight())
158-
<x-mary-button x-on:click="hidden = !hidden" @class(["btn-ghost btn-xs btn-circle -m-1", "!end-9" => $clearable])>
163+
<x-mary-button
164+
x-on:click="hidden = !hidden"
165+
@class(["btn-ghost btn-xs btn-circle -m-1", "!end-9" => $clearable])
166+
:tabindex="$passwordIconTabindex ? null : -1"
167+
>
159168
<x-mary-icon name="{{ $passwordIcon }}" x-show="hidden" class="w-4 h-4 opacity-40" />
160169
<x-mary-icon name="{{ $passwordVisibleIcon }}" x-show="!hidden" x-cloak class="w-4 h-4 opacity-40" />
161170
</x-mary-button>

0 commit comments

Comments
 (0)