Skip to content

Commit 0543ef5

Browse files
committed
hide warning when capslock off and fix popup design
1 parent 21e4ed9 commit 0543ef5

File tree

5 files changed

+27
-53
lines changed

5 files changed

+27
-53
lines changed

src/js/_enqueues/admin/user-profile.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,10 @@
354354

355355
// Skip CapsLock key itself.
356356
if ( ev.key === 'CapsLock' ) {
357+
if (capsLockOn) {
358+
capsLockOn = false;
359+
$capsWarning.hide();
360+
}
357361
return;
358362
}
359363

src/wp-admin/css/forms.css

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -717,46 +717,16 @@ fieldset label,
717717
/* Caps lock warning */
718718
.wp-pwd .caps-warning {
719719
display: none;
720-
position: absolute;
721-
background: #FFFDD6;
722-
border: 1px solid #ddd;
723-
border-radius: 3px;
724-
color: #1E1E20;
725-
font-size: 13px;
720+
position: relative;
721+
background: #f5e6ab;
726722
padding: 6px 10px;
727-
top: calc(100% - 25px);
728-
left: 24px;
729-
white-space: nowrap;
730-
z-index: 10;
731-
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
732-
}
733-
734-
.wp-pwd .caps-warning::before {
735-
content: '';
736-
position: absolute;
737-
bottom: 100%;
738-
left: 15px;
739-
margin-left: -8px;
740-
border-width: 8px;
741-
border-style: solid;
742-
border-color: transparent transparent #ddd transparent;
743-
}
744-
745-
.wp-pwd .caps-warning::after {
746-
content: '';
747-
position: absolute;
748-
bottom: 100%;
749-
left: 15px;
750-
margin-left: -7px;
751-
border-width: 7px;
752-
border-style: solid;
753-
border-color: transparent transparent #FFFDD6 transparent;
723+
top: -8px;
754724
}
755725

756726
.wp-pwd .caps-icon {
757727
display: inline-flex;
758728
justify-content: center;
759-
background-color: #FFF972;
729+
background-color: #fcf9e8;
760730
width: 20px;
761731
height: 20px;
762732
border-radius: 3px;

src/wp-admin/user-edit.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,15 @@
698698
<div class="password-input-wrapper">
699699
<input type="password" name="pass1" id="pass1" class="regular-text" value="" autocomplete="new-password" spellcheck="false" data-pw="<?php echo esc_attr( wp_generate_password( 24 ) ); ?>" aria-describedby="pass-strength-result" />
700700
<div style="display:none" id="pass-strength-result" aria-live="polite"></div>
701+
<div id="caps-warning" class="caps-warning">
702+
<span class="caps-icon">
703+
<svg viewBox="0 0 24 26" xmlns="http://www.w3.org/2000/svg" fill="#3c434a" stroke="#3c434a" stroke-width="0.5">
704+
<path d="M12 5L19 15H16V19H8V15H5L12 5Z"/>
705+
<rect x="8" y="21" width="8" height="1.5" rx="0.75"/>
706+
</svg>
707+
</span>
708+
<span class="caps-warning-text"><?php _e( 'Caps lock is on.' ); ?></span>
709+
</div>
701710
</div>
702711
<button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
703712
<span class="dashicons dashicons-hidden" aria-hidden="true"></span>
@@ -707,15 +716,6 @@
707716
<span class="dashicons dashicons-no" aria-hidden="true"></span>
708717
<span class="text"><?php _e( 'Cancel' ); ?></span>
709718
</button>
710-
<div id="caps-warning" class="caps-warning">
711-
<span class="caps-icon">
712-
<svg viewBox="0 0 24 26" xmlns="http://www.w3.org/2000/svg" fill="#2c3338" stroke="#2c3338" stroke-width="0.5">
713-
<path d="M12 5L19 15H16V19H8V15H5L12 5Z"/>
714-
<rect x="8" y="21" width="8" height="1.5" rx="0.75"/>
715-
</svg>
716-
</span>
717-
<span class="caps-warning-text"><?php _e( 'Caps lock is on.' ); ?></span>
718-
</div>
719719
</div>
720720
</td>
721721
</tr>

src/wp-admin/user-new.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -602,20 +602,20 @@
602602
<div class="password-input-wrapper">
603603
<input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="new-password" spellcheck="false" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" />
604604
<div style="display:none" id="pass-strength-result" aria-live="polite"></div>
605+
<div id="caps-warning" class="caps-warning">
606+
<span class="caps-icon">
607+
<svg viewBox="0 0 24 26" xmlns="http://www.w3.org/2000/svg" fill="#3c434a" stroke="#3c434a" stroke-width="0.5">
608+
<path d="M12 5L19 15H16V19H8V15H5L12 5Z"/>
609+
<rect x="8" y="21" width="8" height="1.5" rx="0.75"/>
610+
</svg>
611+
</span>
612+
<span class="caps-warning-text"><?php _e( 'Caps lock is on.' ); ?></span>
613+
</div>
605614
</div>
606615
<button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
607616
<span class="dashicons dashicons-hidden" aria-hidden="true"></span>
608617
<span class="text"><?php _e( 'Hide' ); ?></span>
609618
</button>
610-
<div id="caps-warning" class="caps-warning">
611-
<span class="caps-icon">
612-
<svg viewBox="0 0 24 26" xmlns="http://www.w3.org/2000/svg" fill="#2c3338" stroke="#2c3338" stroke-width="0.5">
613-
<path d="M12 5L19 15H16V19H8V15H5L12 5Z"/>
614-
<rect x="8" y="21" width="8" height="1.5" rx="0.75"/>
615-
</svg>
616-
</span>
617-
<span class="caps-warning-text"><?php _e( 'Caps lock is on.' ); ?></span>
618-
</div>
619619
</div>
620620
</td>
621621
</tr>

src/wp-login.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ function wp_login_viewport_meta() {
15241524
</button>
15251525
<div id="caps-warning" class="caps-warning">
15261526
<span class="caps-icon">
1527-
<svg viewBox="0 0 24 26" xmlns="http://www.w3.org/2000/svg" fill="#2c3338" stroke="#2c3338" stroke-width="0.5">
1527+
<svg viewBox="0 0 24 26" xmlns="http://www.w3.org/2000/svg" fill="#3c434a" stroke="#3c434a" stroke-width="0.5">
15281528
<path d="M12 5L19 15H16V19H8V15H5L12 5Z"/>
15291529
<rect x="8" y="21" width="8" height="1.5" rx="0.75"/>
15301530
</svg>

0 commit comments

Comments
 (0)