Skip to content

Commit 189a1b2

Browse files
arraypressclaude
andcommitted
One size for a price, and no eye unless asked
A money box ran the width of whatever held it, which on a settings screen was the whole row and in a narrow cell a sliver. It is core's regular-text width everywhere now, and a panel that wants it wider says so. The password reveal is off unless a field asks for it: core offers that button where somebody sets a password they will type again, and an API key pasted once and never shown back is not that. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015Kwx2STJ4EaVaJofEJJ9Zo
1 parent 807c58a commit 189a1b2

4 files changed

Lines changed: 16 additions & 8 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Sanitising coerces; it does not refuse. `required` and `validate` do the
9494
refusing on the server: a value that fails is left where it was, every other
9595
field is saved, and the message is kept for the next render. Options can name
9696
a preset instead of listing choices. Any single-line input takes a `prefix`
97-
or a `suffix`, a password can be revealed, and a `maxlength` shows a count. A
97+
or a `suffix`, a password can offer a reveal, and a `maxlength` shows a count. A
9898
`region` follows the country beside it.
9999

100100
```php

‎assets/css/field-kit.css‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3254,12 +3254,17 @@ span.field-kit__provider-logo {
32543254
A flex box, not a block: the input is then the box's whole height, and
32553255
the symbol centred on the box is centred on the input. As a block the
32563256
box was taller than the input by the line's descender, and the symbol
3257-
sat a few pixels high of the digits beside it. */
3257+
sat a few pixels high of the digits beside it -- and it ran the width
3258+
of whatever held it, so a price on a settings screen was the width of
3259+
the desk and one in a narrow cell a sliver. It is core's regular-text
3260+
width now, wherever it is, and a panel that wants it wider says so. */
32583261
.field-kit__money {
3259-
display: flex;
3262+
display: inline-flex;
32603263
align-items: stretch;
32613264
position: relative;
3265+
width: 25em;
32623266
max-width: 100%;
3267+
vertical-align: middle;
32633268
}
32643269

32653270
/* The symbol is a zone at the start of the input: centred in its own

‎src/Types/PasswordType.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ protected function input_type(): string {
5151
protected function control( Field $field, Attributes $attributes ): string {
5252
$input = parent::control( $field, $attributes );
5353

54-
if ( ! (bool) $field->get( 'reveal', true ) ) {
54+
// Off unless asked for. Core offers the button where somebody is
55+
// setting a password they will have to type again; an API key pasted
56+
// once and never shown back is not that.
57+
if ( ! (bool) $field->get( 'reveal', false ) ) {
5558
return $input;
5659
}
5760

‎tests/PasswordRevealTest.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
final class PasswordRevealTest extends TestCase {
2424

2525
public function test_the_toggle_is_cores_own(): void {
26-
$html = $this->render( [] );
26+
$html = $this->render( [ 'reveal' => true ] );
2727

2828
$this->assertStringContainsString( '<span class="field-kit__password"><input', $html );
2929
$this->assertStringContainsString(
@@ -32,16 +32,16 @@ public function test_the_toggle_is_cores_own(): void {
3232
);
3333
}
3434

35-
public function test_it_is_on_unless_turned_off(): void {
36-
$html = $this->render( [ 'reveal' => false ] );
35+
public function test_it_is_off_unless_asked_for(): void {
36+
$html = $this->render( [] );
3737

3838
$this->assertStringNotContainsString( 'field-kit__password', $html );
3939
$this->assertStringNotContainsString( '<button', $html );
4040
$this->assertStringContainsString( 'type="password"', $html );
4141
}
4242

4343
public function test_the_stored_value_is_still_never_sent_to_the_page(): void {
44-
$html = $this->render( [], 'hunter2' );
44+
$html = $this->render( [ 'reveal' => true ], 'hunter2' );
4545

4646
$this->assertStringContainsString( 'value=""', $html );
4747
$this->assertStringNotContainsString( 'hunter2', $html );

0 commit comments

Comments
 (0)